p align="justify"> 'Set the focus to the first button on the form,
'and then hide all of the buttons on the form
« but the first. You can »t hide the field with the focus.! [Option1]. SetFocusintOption=2 To conNumButtons («Option» & intOption). Visible=False («OptionLabel» & intOption). Visible=FalseintOption
'Open the table of Switchboard Items, and find
« the first item for this Switchboard Page.con=Application. CurrentProject. Connection=«SELECT * FROM [Switchboard Items]»=stSql & « WHERE [ItemNumber]> 0 AND [SwitchboardID]=» & Me! [SwitchboardID]=stSql & « ORDER BY [ItemNumber]; »Rs=CreateObject (« ADODB. Recordset »). Open stSql, con, 1 » 1=adOpenKeyset
'If there are no options for this Switchboard Page,
'display a message. Otherwise, fill the page with the items. (Rs. EOF) Then! [OptionLabel1]. Caption=«На сторінці кнопкової форми немає елементів» (Not (rs. EOF)) («Option» & rs! [ItemNumber]). Visible=True («OptionLabel» & rs! [ItemNumber]). Visible=True («OptionLabel» & rs! [ItemNumber]). Caption=rs! [ItemText]. MoveNextIf
'Close the recordset and the database .. Closers=Nothingcon=NothingSubFunction HandleButtonClick (intBtn As Integer)
'This function is called when a button is clicked.
'intBtn indicates which button was clicked.
'Constants for the commands that can be executed.conCmdGotoSwitchboard=1conCmdOpenFormAdd=2conCmdOpenFormBrowse=3conCmdOpenReport=4conCmdCustomizeSwitchboard=5conCmdExitApplication=6conCmdRunMacro=7conCmdRunCode=8conCmdOpenPage=9
'An error that is special cased.conErrDoCmdCancelled=2501con As Objectrs As ObjectstSql As StringError GoTo HandleButtonClick_Err
'Find the item in the Switchboard Items table
« that corresponds to the button that was clicked.con=Application. CurrentProject. Connectionrs=CreateObject («ADODB. Recordset»)=«SELECT * FROM [Switchboard Items]»=stSql & «WHERE [SwitchboardID] =» & Me! [SwitchboardID] & « AND [ItemNumber]=» & intBtn. Open stSql, con, 1 » 1=adOpenKeyset
'If no item matches, report the error and exit the function. (rs. EOF) Then «Помилка при читанні таблиці Switchboard Items. ». Closers=Nothingcon=NothingFunctionIfCase rs! [Command]
'Go to another switchboard.conCmdGotoSwitchboard. Filter=« [ItemNumber]=0 AND [SwitchboardID]=» & rs! [Argument]
'Open a form in Add mode.conCmdOpenFormAdd. OpenForm rs! [Argument],,,, acAdd
'Open a form.conCmdOpenFormBrowse. OpenForm rs! [Argument]
'Open a report.conCmdOpenReport. OpenReport rs! [Argument], acPreview
'Customize the Switchboard.conCmdCustomizeSwitchboard
'Handle the case where the Switchboard Manager
'is not installed (eg Minimal Install). Error Resume Nextn «ACWZMAIN. sbm_Entry »(Err <> 0) Then MsgBox« Команда недоступна. »Error GoTo 0
« Update the form .. Filter=« [ItemNumber]=0 AND [Argument]=»За замовчуванням '«. Caption=Nz (Me! [ItemText], »»)
...