I need some help (obviously otherwise I wouldn't be posting )
I don't use Access that much and recently our IT Section has moved over to Access 2000. I had a Database in Access 97 prior to this and when it converted it to 2000 it produced an error on the switchboard. The error message drew attention to an ambiguous name and highlighted the following.
Option Compare Database
Option Explicit
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
I've copied the whole script of the switchboard below in the hope that someone out there can help.
Option Compare Database
Option Explicit
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
End Sub
e As String
strDocName = "Registration_Certificate"
DoCmd.OpenReport stDocName, acPreview, "[Registration_Certificate].RecordID = " & RecordID
Exit_Print_Registration_Certificate_Click:
Exit Sub
Err_Print_Registration_Certificate_Click:
MsgBox Err.Description
Resume Exit_Print_Registration_Certificate_Click
End Sub
Private Sub Apply_Filter_Click()
On Error GoTo Err_Apply_Filter_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70
Exit_Apply_Filter_Click:
Exit Sub
Err_Apply_Filter_Click:
MsgBox Err.Description
Resume Exit_Apply_Filter_Click
End Sub
Private Sub Find_Record_Click()
On Error GoTo Err_Find_Record_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Find_Record_Click:
Exit Sub
Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click
End Sub
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If
End Function
ECT * FROM [Switchboard Items]"
strSQL = strSQL & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
strSQL = strSQL & " ORDER BY [ItemNumber];"
Set rst = dbs.OpenRecordset(strSQL)
' If there are no options for this Switchboard Page,
' display a message. Otherwise, fill the page with the items.
If (rst.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this switchboard page"
Else
While (Not (rst.EOF))
Me("Option" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Caption = rst![ItemText]
rst.MoveNext
Wend
End If
' Close the recordset and the database.
rst.Close
dbs.Close
End Sub
Private Function 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.
Const conCmdGotoSwitchboard = 1
Const conCmdOpenFormAdd = 2
Const conCmdOpenFormBrowse = 3
Const conCmdOpenReport = 4
Const conCmdCustomizeSwitchboard = 5
Const conCmdExitApplication = 6
Const conCmdRunMacro = 7
Const conCmdRunCode = 8
' An error that is special cased.
Const conErrDoCmdCancelled = 2501
Dim dbs As Database
Dim rst As Recordset
On Error GoTo HandleButtonClick_Err
' Find the item in the Switchboard Items table
' that corresponds to the button that was clicked.
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Switchboard Items", dbOpenDynaset)
rst.FindFirst "[SwitchboardID]=" & Me![SwitchboardID] & " AND [ItemNumber]=" & intBtn
' If no item matches, report the error and exit the function.
If (rst.NoMatch) Then
MsgBox "There was an error reading the Switchboard Items table."
rst.Close
dbs.Close
Exit Function
End If
Select Case rst![Command]
' Go to another switchboard.
Case conCmdGotoSwitchboard
Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rst![Argument]
' Open a form in Add mode.
Case conCmdOpenFormAdd
DoCmd.OpenForm rst![Argument], , , , acAdd
' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rst![Argument]
' Open a report.
Case conCmdOpenReport
ÐBash0{2477
|Creata„blCTrue]
@Templat@eDeriv%C€ustomizD$Option ?Comp
€<lic€it
P
Op
ÀH©MsgBox?S.De`scripÁ£R8esuÀ¬f$† ndC$
¥L$Fin>dÀ`Cù#ÎÇ#Sc reen."Pou
rdseüt áTA{ M¢-¤ F.‚1cdbsÉ
Â
ƒxButtà~ g4k_á::£A F8uncK¡°rrY„' i!aÂ
¡)0Árs,Â+Þf ƒ…c#a2iàv§R=IP
wÇÍ?ä"EBà!a
ÓTÿaÙ0‡^¿1ç4ÿÇƲ^Gñ9°.M?q7—WeLndÓ
Q‚pƒcan €be exec ¡q‘ÖjCmdGoìtoø;à1ÃIÑ8i1?AdQ™2BhrowÒ£3?1R eport@4ÿ%›eë5ŸExi0tApp°Ã¬= 6ORunMac4roÀ7ßÐCoàmBzã' An `error@$3—søpec`› lð¨´#v`ErrDo#¡lóàài50ä3Oà¬?!?P(?#H€¨n ³p Go€nþ&_Àý/F°"/‘Dð#²
_gVg[w["Î",à]‘ Dyn]?·t´K9ÑF‰"ßk?fRË`@~"ÃqÿÔEBiS9#… [@b’Ôma°Ïe°xrã(±^÷ƒ?3À2id“<„5_NoMñ~_sgBðox "#^!°7SáÑdingï
¶Êk×
np
ñ&äKò;O²†áÆ,
ÚóPýOdOÓÙðbc*Ÿ•SUS _
_
_
_
_
_
_
_
_
_
_
Option Compare Database
Option Explicit
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
End Sub
e As String
strDocName = "Registration_Certificate"
DoCmd.OpenReport stDocName, acPreview, "[Registration_Certificate].RecordID = " & RecordID
Exit_Print_Registration_Certificate_Click:
Exit Sub
Err_Print_Registration_Certificate_Click:
MsgBox Err.Description
Resume Exit_Print_Registration_Certificate_Click
End Sub
Private Sub Apply_Filter_Click()
On Error GoTo Err_Apply_Filter_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70
Exit_Apply_Filter_Click:
Exit Sub
Err_Apply_Filter_Click:
MsgBox Err.Description
Resume Exit_Apply_Filter_Click
End Sub
Private Sub Find_Record_Click()
On Error GoTo Err_Find_Record_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Find_Record_Click:
Exit Sub
Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click
End Sub
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If
End Function
ECT * FROM [Switchboard Items]"
strSQL = strSQL & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
strSQL = strSQL & " ORDER BY [ItemNumber];"
Set rst = dbs.OpenRecordset(strSQL)
' If there are no options for this Switchboard Page,
' display a message. Otherwise, fill the page with the items.
If (rst.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this switchboard page"
Else
While (Not (rst.EOF))
Me("Option" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Caption = rst![ItemText]
rst.MoveNext
Wend
End If
' Close the recordset and the database.
rst.Close
dbs.Close
End Sub
Private Function 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.
Const conCmdGotoSwitchboard = 1
Const conCmdOpenFormAdd = 2
Const conCmdOpenFormBrowse = 3
Const conCmdOpenReport = 4
Const conCmdCustomizeSwitchboard = 5
Const conCmdExitApplication = 6
Const conCmdRunMacro = 7
Const conCmdRunCode = 8
' An error that is special cased.
Const conErrDoCmdCancelled = 2501
Dim dbs As Database
Dim rst As Recordset
On Error GoTo HandleButtonClick_Err
' Find the item in the Switchboard Items table
' that corresponds to the button that was clicked.
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Switchboard Items", dbOpenDynaset)
rst.FindFirst "[SwitchboardID]=" & Me![SwitchboardID] & " AND [ItemNumber]=" & intBtn
' If no item matches, report the error and exit the function.
If (rst.NoMatch) Then
MsgBox "There was an error reading the Switchboard Items table."
rst.Close
dbs.Close
Exit Function
End If
Select Case rst![Command]
' Go to another switchboard.
Case conCmdGotoSwitchboard
Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rst![Argument]
' Open a form in Add mode.
Case conCmdOpenFormAdd
DoCmd.OpenForm rst![Argument], , , , acAdd
' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rst![Argument]
' Open a report.
Case conCmdOpenReport
ÐBash0{2477
|Creata„blCTrue]
@Templat@eDeriv%C€ustomizD$Option ?Comp
€<lic€it
P
Op
ÀH©MsgBox?S.De`scripÁ£R8esuÀ¬f$† ndC$
¥L$Fin>dÀ`Cù#ÎÇ#Sc reen."Pou
rdseüt áTA{ M¢-¤ F.‚1cdbsÉ
Â
ƒxButtà~ g4k_á::£A F8uncK¡°rrY„' i!aÂ
¡)0Árs,Â+Þf ƒ…c#a2iàv§R=IP
wÇÍ?ä"EBà!a
ÓTÿaÙ0‡^¿1ç4ÿÇƲ^Gñ9°.M?q7—WeLndÓ
Q‚pƒcan €be exec ¡q‘ÖjCmdGoìtoø;à1ÃIÑ8i1?AdQ™2BhrowÒ£3?1R eport@4ÿ%›eë5ŸExi0tApp°Ã¬= 6ORunMac4roÀ7ßÐCoàmBzã' An `error@$3—søpec`› lð¨´#v`ErrDo#¡lóàài50ä3Oà¬?!?P(?#H€¨n ³p Go€nþ&_Àý/F°"/‘Dð#²
_gVg[w["Î",à]‘ Dyn]?·t´K9ÑF‰"ßk?fRË`@~"ÃqÿÔEBiS9#… [@b’Ôma°Ïe°xrã(±^÷ƒ?3À2id“<„5_NoMñ~_sgBðox "#^!°7SáÑdingï
¶Êk×
np
ñ&äKò;O²†áÆ,
ÚóPýOdOÓÙðbc*Ÿ•SUS _
_
_
_
_
_
_
_
_
_
_
Option Compare Database
Option Explicit
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
End Sub
e As String
strDocName = "Registration_Certificate"
DoCmd.OpenReport stDocName, acPreview, "[Registration_Certificate].RecordID = " & RecordID
Exit_Print_Registration_Certificate_Click:
Exit Sub
Err_Print_Registration_Certificate_Click:
MsgBox Err.Description
Resume Exit_Print_Registration_Certificate_Click
End Sub
Private Sub Apply_Filter_Click()
On Error GoTo Err_Apply_Filter_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70
Exit_Apply_Filter_Click:
Exit Sub
Err_Apply_Filter_Click:
MsgBox Err.Description
Resume Exit_Apply_Filter_Click
End Sub
Private Sub Find_Record_Click()
On Error GoTo Err_Find_Record_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Find_Record_Click:
Exit Sub
Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click
End Sub
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If
End Function
ECT * FROM [Switchboard Items]"
strSQL = strSQL & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
strSQL = strSQL & " ORDER BY [ItemNumber];"
Set rst = dbs.OpenRecordset(strSQL)
' If there are no options for this Switchboard Page,
' display a message. Otherwise, fill the page with the items.
If (rst.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this switchboard page"
Else
While (Not (rst.EOF))
Me("Option" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Caption = rst![ItemText]
rst.MoveNext
Wend
End If
' Close the recordset and the database.
rst.Close
dbs.Close
End Sub
Private Function 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.
Const conCmdGotoSwitchboard = 1
Const conCmdOpenFormAdd = 2
Const conCmdOpenFormBrowse = 3
Const conCmdOpenReport = 4
Const conCmdCustomizeSwitchboard = 5
Const conCmdExitApplication = 6
Const conCmdRunMacro = 7
Const conCmdRunCode = 8
' An error that is special cased.
Const conErrDoCmdCancelled = 2501
Dim dbs As Database
Dim rst As Recordset
On Error GoTo HandleButtonClick_Err
' Find the item in the Switchboard Items table
' that corresponds to the button that was clicked.
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Switchboard Items", dbOpenDynaset)
rst.FindFirst "[SwitchboardID]=" & Me![SwitchboardID] & " AND [ItemNumber]=" & intBtn
' If no item matches, report the error and exit the function.
If (rst.NoMatch) Then
MsgBox "There was an error reading the Switchboard Items table."
rst.Close
dbs.Close
Exit Function
End If
Select Case rst![Command]
' Go to another switchboard.
Case conCmdGotoSwitchboard
Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rst![Argument]
' Open a form in Add mode.
Case conCmdOpenFormAdd
DoCmd.OpenForm rst![Argument], , , , acAdd
' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rst![Argument]
' Open a report.
Case conCmdOpenReport
ÿÿÿ
P
(
x
"
ÀBas`0{
|Cr@eatablCTrue]Pred?ecla
@Tem
€<licit
P
EndCÀ+vEDFin
wÇÍ?ä"EBà!a
ÓTÿaÙ0‡^¿1ç4ÿÇƲ^Gñ9°.M?q7—WeLndÓ
Q‚pƒcan €be exec ¡q‘ÖjCmdGoìtoø;à1ÃIÑ8i1?AdQ™2BhrowÒ£3?1R eport@4ÿ%›eë5ŸExi0tApp°Ã¬= 6ORunMac4roÀ7ßÐCoàmBzã' An `error@$3—søpec`› lð¨´#v`ErrDo#¡lóàài50ä3Oà¬?!?P(?#H€¨n ³p Go€nþ&_Àý/F°"/‘Dð#²
_gVg[w["Î",à]‘ Dyn]?·t´K9ÑF‰"ßk?fRË`@~"ÃqÿÔEBiS9#… [@b’Ôma°Ïe°xrã(±^÷ƒ?3À2id“<„5_NoMñ~_sgBðox "#^!°7SáÑdingï
¶Êk×
np
ñ&äKò;O²†áÆ,
ÚóPýOdOÓÙðbc*Ÿ•SUS _
_
_
_
_
_
_
_
_
_
_
I don't use Access that much and recently our IT Section has moved over to Access 2000. I had a Database in Access 97 prior to this and when it converted it to 2000 it produced an error on the switchboard. The error message drew attention to an ambiguous name and highlighted the following.
Option Compare Database
Option Explicit
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
I've copied the whole script of the switchboard below in the hope that someone out there can help.
Option Compare Database
Option Explicit
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
End Sub
e As String
strDocName = "Registration_Certificate"
DoCmd.OpenReport stDocName, acPreview, "[Registration_Certificate].RecordID = " & RecordID
Exit_Print_Registration_Certificate_Click:
Exit Sub
Err_Print_Registration_Certificate_Click:
MsgBox Err.Description
Resume Exit_Print_Registration_Certificate_Click
End Sub
Private Sub Apply_Filter_Click()
On Error GoTo Err_Apply_Filter_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70
Exit_Apply_Filter_Click:
Exit Sub
Err_Apply_Filter_Click:
MsgBox Err.Description
Resume Exit_Apply_Filter_Click
End Sub
Private Sub Find_Record_Click()
On Error GoTo Err_Find_Record_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Find_Record_Click:
Exit Sub
Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click
End Sub
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If
End Function
ECT * FROM [Switchboard Items]"
strSQL = strSQL & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
strSQL = strSQL & " ORDER BY [ItemNumber];"
Set rst = dbs.OpenRecordset(strSQL)
' If there are no options for this Switchboard Page,
' display a message. Otherwise, fill the page with the items.
If (rst.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this switchboard page"
Else
While (Not (rst.EOF))
Me("Option" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Caption = rst![ItemText]
rst.MoveNext
Wend
End If
' Close the recordset and the database.
rst.Close
dbs.Close
End Sub
Private Function 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.
Const conCmdGotoSwitchboard = 1
Const conCmdOpenFormAdd = 2
Const conCmdOpenFormBrowse = 3
Const conCmdOpenReport = 4
Const conCmdCustomizeSwitchboard = 5
Const conCmdExitApplication = 6
Const conCmdRunMacro = 7
Const conCmdRunCode = 8
' An error that is special cased.
Const conErrDoCmdCancelled = 2501
Dim dbs As Database
Dim rst As Recordset
On Error GoTo HandleButtonClick_Err
' Find the item in the Switchboard Items table
' that corresponds to the button that was clicked.
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Switchboard Items", dbOpenDynaset)
rst.FindFirst "[SwitchboardID]=" & Me![SwitchboardID] & " AND [ItemNumber]=" & intBtn
' If no item matches, report the error and exit the function.
If (rst.NoMatch) Then
MsgBox "There was an error reading the Switchboard Items table."
rst.Close
dbs.Close
Exit Function
End If
Select Case rst![Command]
' Go to another switchboard.
Case conCmdGotoSwitchboard
Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rst![Argument]
' Open a form in Add mode.
Case conCmdOpenFormAdd
DoCmd.OpenForm rst![Argument], , , , acAdd
' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rst![Argument]
' Open a report.
Case conCmdOpenReport
ÐBash0{2477
|Creata„blCTrue]
@Templat@eDeriv%C€ustomizD$Option ?Comp
€<lic€it
P
Op
ÀH©MsgBox?S.De`scripÁ£R8esuÀ¬f$† ndC$
¥L$Fin>dÀ`Cù#ÎÇ#Sc reen."Pou
rdseüt áTA{ M¢-¤ F.‚1cdbsÉ
Â
ƒxButtà~ g4k_á::£A F8uncK¡°rrY„' i!aÂ
¡)0Árs,Â+Þf ƒ…c#a2iàv§R=IP
wÇÍ?ä"EBà!a
ÓTÿaÙ0‡^¿1ç4ÿÇƲ^Gñ9°.M?q7—WeLndÓ
Q‚pƒcan €be exec ¡q‘ÖjCmdGoìtoø;à1ÃIÑ8i1?AdQ™2BhrowÒ£3?1R eport@4ÿ%›eë5ŸExi0tApp°Ã¬= 6ORunMac4roÀ7ßÐCoàmBzã' An `error@$3—søpec`› lð¨´#v`ErrDo#¡lóàài50ä3Oà¬?!?P(?#H€¨n ³p Go€nþ&_Àý/F°"/‘Dð#²
_gVg[w["Î",à]‘ Dyn]?·t´K9ÑF‰"ßk?fRË`@~"ÃqÿÔEBiS9#… [@b’Ôma°Ïe°xrã(±^÷ƒ?3À2id“<„5_NoMñ~_sgBðox "#^!°7SáÑdingï
¶Êk×
np
ñ&äKò;O²†áÆ,
ÚóPýOdOÓÙðbc*Ÿ•SUS _
_
_
_
_
_
_
_
_
_
_
Option Compare Database
Option Explicit
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
End Sub
e As String
strDocName = "Registration_Certificate"
DoCmd.OpenReport stDocName, acPreview, "[Registration_Certificate].RecordID = " & RecordID
Exit_Print_Registration_Certificate_Click:
Exit Sub
Err_Print_Registration_Certificate_Click:
MsgBox Err.Description
Resume Exit_Print_Registration_Certificate_Click
End Sub
Private Sub Apply_Filter_Click()
On Error GoTo Err_Apply_Filter_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70
Exit_Apply_Filter_Click:
Exit Sub
Err_Apply_Filter_Click:
MsgBox Err.Description
Resume Exit_Apply_Filter_Click
End Sub
Private Sub Find_Record_Click()
On Error GoTo Err_Find_Record_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Find_Record_Click:
Exit Sub
Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click
End Sub
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If
End Function
ECT * FROM [Switchboard Items]"
strSQL = strSQL & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
strSQL = strSQL & " ORDER BY [ItemNumber];"
Set rst = dbs.OpenRecordset(strSQL)
' If there are no options for this Switchboard Page,
' display a message. Otherwise, fill the page with the items.
If (rst.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this switchboard page"
Else
While (Not (rst.EOF))
Me("Option" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Caption = rst![ItemText]
rst.MoveNext
Wend
End If
' Close the recordset and the database.
rst.Close
dbs.Close
End Sub
Private Function 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.
Const conCmdGotoSwitchboard = 1
Const conCmdOpenFormAdd = 2
Const conCmdOpenFormBrowse = 3
Const conCmdOpenReport = 4
Const conCmdCustomizeSwitchboard = 5
Const conCmdExitApplication = 6
Const conCmdRunMacro = 7
Const conCmdRunCode = 8
' An error that is special cased.
Const conErrDoCmdCancelled = 2501
Dim dbs As Database
Dim rst As Recordset
On Error GoTo HandleButtonClick_Err
' Find the item in the Switchboard Items table
' that corresponds to the button that was clicked.
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Switchboard Items", dbOpenDynaset)
rst.FindFirst "[SwitchboardID]=" & Me![SwitchboardID] & " AND [ItemNumber]=" & intBtn
' If no item matches, report the error and exit the function.
If (rst.NoMatch) Then
MsgBox "There was an error reading the Switchboard Items table."
rst.Close
dbs.Close
Exit Function
End If
Select Case rst![Command]
' Go to another switchboard.
Case conCmdGotoSwitchboard
Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rst![Argument]
' Open a form in Add mode.
Case conCmdOpenFormAdd
DoCmd.OpenForm rst![Argument], , , , acAdd
' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rst![Argument]
' Open a report.
Case conCmdOpenReport
ÐBash0{2477
|Creata„blCTrue]
@Templat@eDeriv%C€ustomizD$Option ?Comp
€<lic€it
P
Op
ÀH©MsgBox?S.De`scripÁ£R8esuÀ¬f$† ndC$
¥L$Fin>dÀ`Cù#ÎÇ#Sc reen."Pou
rdseüt áTA{ M¢-¤ F.‚1cdbsÉ
Â
ƒxButtà~ g4k_á::£A F8uncK¡°rrY„' i!aÂ
¡)0Árs,Â+Þf ƒ…c#a2iàv§R=IP
wÇÍ?ä"EBà!a
ÓTÿaÙ0‡^¿1ç4ÿÇƲ^Gñ9°.M?q7—WeLndÓ
Q‚pƒcan €be exec ¡q‘ÖjCmdGoìtoø;à1ÃIÑ8i1?AdQ™2BhrowÒ£3?1R eport@4ÿ%›eë5ŸExi0tApp°Ã¬= 6ORunMac4roÀ7ßÐCoàmBzã' An `error@$3—søpec`› lð¨´#v`ErrDo#¡lóàài50ä3Oà¬?!?P(?#H€¨n ³p Go€nþ&_Àý/F°"/‘Dð#²
_gVg[w["Î",à]‘ Dyn]?·t´K9ÑF‰"ßk?fRË`@~"ÃqÿÔEBiS9#… [@b’Ôma°Ïe°xrã(±^÷ƒ?3À2id“<„5_NoMñ~_sgBðox "#^!°7SáÑdingï
¶Êk×
np
ñ&äKò;O²†áÆ,
ÚóPýOdOÓÙðbc*Ÿ•SUS _
_
_
_
_
_
_
_
_
_
_
Option Compare Database
Option Explicit
Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
End Sub
e As String
strDocName = "Registration_Certificate"
DoCmd.OpenReport stDocName, acPreview, "[Registration_Certificate].RecordID = " & RecordID
Exit_Print_Registration_Certificate_Click:
Exit Sub
Err_Print_Registration_Certificate_Click:
MsgBox Err.Description
Resume Exit_Print_Registration_Certificate_Click
End Sub
Private Sub Apply_Filter_Click()
On Error GoTo Err_Apply_Filter_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70
Exit_Apply_Filter_Click:
Exit Sub
Err_Apply_Filter_Click:
MsgBox Err.Description
Resume Exit_Apply_Filter_Click
End Sub
Private Sub Find_Record_Click()
On Error GoTo Err_Find_Record_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_Find_Record_Click:
Exit Sub
Err_Find_Record_Click:
MsgBox Err.Description
Resume Exit_Find_Record_Click
End Sub
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If
End Function
ECT * FROM [Switchboard Items]"
strSQL = strSQL & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
strSQL = strSQL & " ORDER BY [ItemNumber];"
Set rst = dbs.OpenRecordset(strSQL)
' If there are no options for this Switchboard Page,
' display a message. Otherwise, fill the page with the items.
If (rst.EOF) Then
Me![OptionLabel1].Caption = "There are no items for this switchboard page"
Else
While (Not (rst.EOF))
Me("Option" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Visible = True
Me("OptionLabel" & rst![ItemNumber]).Caption = rst![ItemText]
rst.MoveNext
Wend
End If
' Close the recordset and the database.
rst.Close
dbs.Close
End Sub
Private Function 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.
Const conCmdGotoSwitchboard = 1
Const conCmdOpenFormAdd = 2
Const conCmdOpenFormBrowse = 3
Const conCmdOpenReport = 4
Const conCmdCustomizeSwitchboard = 5
Const conCmdExitApplication = 6
Const conCmdRunMacro = 7
Const conCmdRunCode = 8
' An error that is special cased.
Const conErrDoCmdCancelled = 2501
Dim dbs As Database
Dim rst As Recordset
On Error GoTo HandleButtonClick_Err
' Find the item in the Switchboard Items table
' that corresponds to the button that was clicked.
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Switchboard Items", dbOpenDynaset)
rst.FindFirst "[SwitchboardID]=" & Me![SwitchboardID] & " AND [ItemNumber]=" & intBtn
' If no item matches, report the error and exit the function.
If (rst.NoMatch) Then
MsgBox "There was an error reading the Switchboard Items table."
rst.Close
dbs.Close
Exit Function
End If
Select Case rst![Command]
' Go to another switchboard.
Case conCmdGotoSwitchboard
Me.Filter = "[ItemNumber] = 0 AND [SwitchboardID]=" & rst![Argument]
' Open a form in Add mode.
Case conCmdOpenFormAdd
DoCmd.OpenForm rst![Argument], , , , acAdd
' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rst![Argument]
' Open a report.
Case conCmdOpenReport
ÿÿÿ
P
(
x
"
ÀBas`0{
|Cr@eatablCTrue]Pred?ecla
@Tem
€<licit
P
EndCÀ+vEDFin
wÇÍ?ä"EBà!a
ÓTÿaÙ0‡^¿1ç4ÿÇƲ^Gñ9°.M?q7—WeLndÓ
Q‚pƒcan €be exec ¡q‘ÖjCmdGoìtoø;à1ÃIÑ8i1?AdQ™2BhrowÒ£3?1R eport@4ÿ%›eë5ŸExi0tApp°Ã¬= 6ORunMac4roÀ7ßÐCoàmBzã' An `error@$3—søpec`› lð¨´#v`ErrDo#¡lóàài50ä3Oà¬?!?P(?#H€¨n ³p Go€nþ&_Àý/F°"/‘Dð#²
_gVg[w["Î",à]‘ Dyn]?·t´K9ÑF‰"ßk?fRË`@~"ÃqÿÔEBiS9#… [@b’Ôma°Ïe°xrã(±^÷ƒ?3À2id“<„5_NoMñ~_sgBðox "#^!°7SáÑdingï
¶Êk×
np
ñ&äKò;O²†áÆ,
ÚóPýOdOÓÙðbc*Ÿ•SUS _
_
_
_
_
_
_
_
_
_
_