Hi,
Access generated code for switchboard doesn't allow changing the caption
when user select a sub-switchboard.
You have to write your own code to handle this.
Switchboard form uses "Switchboard items" table to store the switchboard
entries and appropriate commands.
The switchboard code uses itemnumber to order the items on a swichboard, and
it starts with 1 and uses positive numbers only. Itemnumber 0 is used as
switchboard name (used when you open a sub-switchboard). You have to change
the FillOptions sub to set the caption to the text from ItemText field for
record with ItemNumber = 0.
Or, if you want to add a longer string as switchboard caption, or simply one
different than switchboard name, you can add by hand another record, set its
SwitchboardID to the switchboardID you want to add a caption for, set
ItemNumber to a value < 0 (like -1), add the text you want to ItemText
Below you find the code which set the caption with the text from ItemNumber
= -1
Private Sub SetSwitchboardCaption()
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("select * from [Switchboard Items]" & _
" WHERE [ItemNumber] = -1 AND [SwitchboardID]=" &
Me![SwitchboardID])
Set rs = db.OpenRecordset(stSql)
If rs.RecordCount > 0 Then
Me.Caption = rs![ItemText]
End If
Set rs = Nothing
Set db = Nothing
End Sub
You have to call this sub from FillOptions sub
This code uses DAO, but it can be easily changed to use ADO instead
HTH,
Bogdan
_____________________________
Freelance programmer