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 Next.Run «ACWZMAIN.sbm_Entry»
If (Err <> 0) Then MsgBox «Команда недоступна.»
On Error GoTo 0
« Update the form .. Filter=«[ItemNumber]=0 AND [Argument] =» За замовчуванням '«. Caption=Nz (Me! [ItemText],» »)
'Exit the application.conCmdExitApplication
'Run a macro.conCmdRunMacro.RunMacro rs! [Argument]
'Run code.conCmdRunCode.Run rs! [Argument]
'Open a Data Access PageconCmdOpenPage.OpenDataAccessPage rs! [Argument]
'Any other command is unrecognized.
Case Else
MsgBox «Невідома команда.» Select
'Close the recordset and the database .. Close_Exit: Error Resume Nextrs=Nothingcon=NothingFunction_Err:
'If the action was cancelled by the user for
« some reason, don »t display an error message.
'Instead, resume on the next line. (Err=conErrDoCmdCancelled) ThenNext
Else «Помилка при виконанні команди.», vbCritical
Resume HandleButtonClick_ExitIf Function
Форма «Нові документи»
Option Compare DatabaseSub Кнопка24_Click () Error GoTo Err_Кнопка24_Click.DoMenuItem acFormBar, acEditMenu, 8,, acMenuVe...