×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Help required with Switchboard in Access 2000.

Help required with Switchboard in Access 2000.

Help required with Switchboard in Access 2000.

(OP)
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$† nd C$
¥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$† nd C$
¥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 _
 _
 _
 _
 _
 _
 _
 _
 _
 _
 _

RE: Help required with Switchboard in Access 2000.

I can't understand that unknown script comes at the end of the code..

If this is a single module then you need to look into that duplicate entries of "Private Sub Detail_Print". that should be once  
Or can you post the code once again exactly what there. It is something like you have pasted twice or three times into..
 

________________________________________________________________________
Zameer Abdulla
Visit Me
A sweater is usually put on a child when the parent feels chilly.

RE: Help required with Switchboard in Access 2000.

(OP)
Thank you.  You have inadvertently solved my problem.  My unfamiliarity with script meant I couldn't see the wood for the trees.  Somehow the conversion process had triplicated the entire script, hence the problem.

Thanks for your time and for answering so quickly and sorry for not spotting that obvious mistake myself.  I'm just happy it's working again.

Regards

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close