Stone 'r Metal ?

Private Sub btnFindNext_Click()
On Error GoTo Err_btnFindNext_Click
    Screen.PreviousControl.SetFocus
    DoCmd.FindNext
Exit_btnFindNext_Click:
    Exit Sub
Err_btnFindNext_Click:
    MsgBox Err.Description
    Resume Exit_btnFindNext_Click
End Sub

Private Sub btnFindRecord_Click()
On Error GoTo Err_btnFindRecord_Click
    Screen.PreviousControl.SetFocus
    DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_btnFindRecord_Click:
    Exit Sub
Err_btnFindRecord_Click:
    MsgBox Err.Description
    Resume Exit_btnFindRecord_Click    
End Sub

Private Sub btnGotoFirst_Click()
On Error GoTo Err_btnGotoFirst_Click
    DoCmd.GoToRecord , , acFirst
Exit_btnGotoFirst_Click:
    Exit Sub
Err_btnGotoFirst_Click:
    MsgBox Err.Description
    Resume Exit_btnGotoFirst_Click    
End Sub

Private Sub btnGotoLastRecord_Click()
On Error GoTo Err_btnGotoLastRecord_Click
    DoCmd.GoToRecord , , acLast
Exit_btnGotoLastRecord_Click:
    Exit Sub
Err_btnGotoLastRecord_Click:
    MsgBox Err.Description
    Resume Exit_btnGotoLastRecord_Click    
End Sub

Private Sub btnGotoNext_Click()
On Error GoTo Err_btnGotoNext_Click
    DoCmd.GoToRecord , , acNext
Exit_btnGotoNext_Click:
    Exit Sub
Err_btnGotoNext_Click:
    MsgBox Err.Description
    Resume Exit_btnGotoNext_Click    
End Sub

Private Sub BtnGotoPrevious_Click()
On Error GoTo Err_BtnGotoPrevious_Click
    DoCmd.GoToRecord , , acPrevious
Exit_BtnGotoPrevious_Click:
    Exit Sub
Err_BtnGotoPrevious_Click:
    MsgBox Err.Description
    Resume Exit_BtnGotoPrevious_Click    
End Sub

Private Sub btnAddNewRecord_Click()
On Error GoTo Err_btnAddNewRecord_Click
    DoCmd.GoToRecord , , acNewRec
Exit_btnAddNewRecord_Click:
    Exit Sub
Err_btnAddNewRecord_Click:
    MsgBox Err.Description
    Resume Exit_btnAddNewRecord_Click    
End Sub

Private Sub btnDeleteRecord_Click()
On Error GoTo Err_btnDeleteRecord_Click
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_btnDeleteRecord_Click:
    Exit Sub
Err_btnDeleteRecord_Click:
    MsgBox Err.Description
    Resume Exit_btnDeleteRecord_Click    
End Sub

Private Sub btnDuplicateRecord_Click()
On Error GoTo Err_btnDuplicateRecord_Click
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Exit_btnDuplicateRecord_Click:
    Exit Sub
Err_btnDuplicateRecord_Click:
    MsgBox Err.Description
    Resume Exit_btnDuplicateRecord_Click 
End Sub

Private Sub btnPrintRecord_Click()
On Error GoTo Err_btnPrintRecord_Click
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.PrintOut acSelection
Exit_btnPrintRecord_Click:
    Exit Sub
Err_btnPrintRecord_Click:
    MsgBox Err.Description
    Resume Exit_btnPrintRecord_Click    
End Sub

Private Sub btnSaveRecord_Click()
On Error GoTo Err_btnSaveRecord_Click
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_btnSaveRecord_Click:
    Exit Sub
Err_btnSaveRecord_Click:
    MsgBox Err.Description
    Resume Exit_btnSaveRecord_Click    
End Sub

Private Sub btnUndoRecord_Click()
On Error GoTo Err_btnUndoRecord_Click
    DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Exit_btnUndoRecord_Click:
    Exit Sub
Err_btnUndoRecord_Click:
    MsgBox Err.Description
    Resume Exit_btnUndoRecord_Click    
End Sub

Private Sub btnApplyFilter_Click()
On Error GoTo Err_btnApplyFilter_Click
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, 2, , acMenuVer70
Exit_btnApplyFilter_Click:
    Exit Sub
Err_btnApplyFilter_Click:
    MsgBox Err.Description
    Resume Exit_btnApplyFilter_Click
End Sub

Private Sub btnCloseForm_Click()
On Error GoTo Err_btnCloseForm_Click
    DoCmd.Close
Exit_btnCloseForm_Click:
    Exit Sub
Err_btnCloseForm_Click:
    MsgBox Err.Description
    Resume Exit_btnCloseForm_Click
End Sub

Private Sub btnEditFilter_Click()
On Error GoTo Err_btnEditFilter_Click
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, 0, 2, acMenuVer70
Exit_btnEditFilter_Click:
    Exit Sub
Err_btnEditFilter_Click:
    MsgBox Err.Description
    Resume Exit_btnEditFilter_Click   
End Sub

Private Sub btnOpenForm_Click()
On Error GoTo Err_btnOpenForm_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "astart"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_btnOpenForm_Click:
    Exit Sub
Err_btnOpenForm_Click:
    MsgBox Err.Description
    Resume Exit_btnOpenForm_Click    
End Sub

Private Sub btnPrintForm_Click()
On Error GoTo Err_btnPrintForm_Click
    Dim stDocName As String
    Dim MyForm As Form
    stDocName = "Buttons"
    Set MyForm = Screen.ActiveForm
    DoCmd.SelectObject acForm, stDocName, True
    DoCmd.PrintOut
    DoCmd.SelectObject acForm, MyForm.Name, False
Exit_btnPrintForm_Click:
    Exit Sub
Err_btnPrintForm_Click:
    MsgBox Err.Description
    Resume Exit_btnPrintForm_Click    
End Sub

Private Sub btnPrintCurrentForm_Click()
On Error GoTo Err_btnPrintCurrentForm_Click
    DoCmd.PrintOut
Exit_btnPrintCurrentForm_Click:
    Exit Sub
Err_btnPrintCurrentForm_Click:
    MsgBox Err.Description
    Resume Exit_btnPrintCurrentForm_Click    
End Sub

Private Sub btnMailReport_Click()
On Error GoTo Err_btnMailReport_Click
    Dim stDocName As String
    stDocName = "IdeaTopic"
    DoCmd.SendObject acReport, stDocName
Exit_btnMailReport_Click:
    Exit Sub
Err_btnMailReport_Click:
    MsgBox Err.Description
    Resume Exit_btnMailReport_Click  
End Sub

Private Sub btnPreviewReport_Click()
On Error GoTo Err_btnPreviewReport_Click
    Dim stDocName As String
    stDocName = "IdeaTopic"
    DoCmd.OpenReport stDocName, acPreview
Exit_btnPreviewReport_Click:
    Exit Sub
Err_btnPreviewReport_Click:
    MsgBox Err.Description
    Resume Exit_btnPreviewReport_Click    
End Sub

Private Sub btnPrintReport_Click()
On Error GoTo Err_btnPrintReport_Click
    Dim stDocName As String
    stDocName = "IdeaTopic"
    DoCmd.OpenReport stDocName, acNormal
Exit_btnPrintReport_Click:
    Exit Sub
Err_btnPrintReport_Click:
    MsgBox Err.Description
    Resume Exit_btnPrintReport_Click    
End Sub

Private Sub btnReportToFileXcelWrdTxt_Click()
On Error GoTo Err_btnReportToFileXcelWrdTxt_Click
    Dim stDocName As String
    stDocName = "IdeaTopic"
    DoCmd.OutputTo acReport, stDocName
Exit_btnReportToFileXcelWrdTxt_Click:
    Exit Sub
Err_btnReportToFileXcelWrdTxt_Click:
    MsgBox Err.Description
    Resume Exit_btnReportToFileXcelWrdTxt_Click    
End Sub

Private Sub btnQuitApp_Click()
On Error GoTo Err_btnQuitApp_Click
    DoCmd.Quit
Exit_btnQuitApp_Click:
    Exit Sub
Err_btnQuitApp_Click:
    MsgBox Err.Description
    Resume Exit_btnQuitApp_Click    
End Sub

Private Sub btnRunAppExe_Click()
On Error GoTo Err_btnRunAppExe_Click
    Dim stAppName As String
    stAppName = "C:\Users\Liam\_d\Battery.exe"
    Call Shell(stAppName, 1)
Exit_btnRunAppExe_Click:
    Exit Sub
Err_btnRunAppExe_Click:
    MsgBox Err.Description
    Resume Exit_btnRunAppExe_Click    
End Sub

Private Sub btnRunNotepad_Click()
On Error GoTo Err_btnRunNotepad_Click
    Call Shell("NOTEPAD.EXE", 1)
Exit_btnRunNotepad_Click:
    Exit Sub
Err_btnRunNotepad_Click:
    MsgBox Err.Description
    Resume Exit_btnRunNotepad_Click    
End Sub

Private Sub btnRunExcel_Click()
On Error GoTo Err_btnRunExcel_Click
    Dim oApp As Object
    Set oApp = CreateObject("Excel.Application")
    oApp.Visible = True
    'Only XL 97 supports UserControl Property
    On Error Resume Next
    oApp.UserControl = True
Exit_btnRunExcel_Click:
    Exit Sub
Err_btnRunExcel_Click:
    MsgBox Err.Description
    Resume Exit_btnRunExcel_Click  
End Sub

Private Sub btnAutoDialer_Click()
On Error GoTo Err_btnAutoDialer_Click
    Dim stDialStr As String
    Dim PrevCtl As Control
    Const ERR_OBJNOTEXIST = 2467
    Const ERR_OBJNOTSET = 91
    Const ERR_CANTMOVE = 2483
    Set PrevCtl = Screen.PreviousControl    
    If TypeOf PrevCtl Is TextBox Then
      stDialStr = IIf(VarType(PrevCtl) > V_NULL, PrevCtl, "")
    ElseIf TypeOf PrevCtl Is ListBox Then
      stDialStr = IIf(VarType(PrevCtl) > V_NULL, PrevCtl, "")
    ElseIf TypeOf PrevCtl Is ComboBox Then
      stDialStr = IIf(VarType(PrevCtl) > V_NULL, PrevCtl, "")
    Else
      stDialStr = ""
    End If    
    Application.Run "utility.wlib_AutoDial", stDialStr
Exit_btnAutoDialer_Click:
    Exit Sub
Err_btnAutoDialer_Click:
    If (Err = ERR_OBJNOTEXIST) Or (Err = ERR_OBJNOTSET) Or (Err = ERR_CANTMOVE) Then
      Resume Next
    End If
    MsgBox Err.Description
    Resume Exit_btnAutoDialer_Click    
End Sub

Private Sub btnPrintTable_Click()
On Error GoTo Err_btnPrintTable_Click
    Dim stDocName As String
    Dim MyForm As Form
    stDocName = "iDEAS"
    Set MyForm = Screen.ActiveForm
    DoCmd.SelectObject acTable, stDocName, True
    DoCmd.PrintOut
    DoCmd.SelectObject acForm, MyForm.Name, False
Exit_btnPrintTable_Click:
    Exit Sub
Err_btnPrintTable_Click:
    MsgBox Err.Description
    Resume Exit_btnPrintTable_Click    
End Sub

Private Sub btnRunMacro_Click()
On Error GoTo Err_btnRunMacro_Click
    Dim stDocName As String
    stDocName = "autoexec"
    DoCmd.RunMacro stDocName
Exit_btnRunMacro_Click:
    Exit Sub
Err_btnRunMacro_Click:
    MsgBox Err.Description
    Resume Exit_btnRunMacro_Click    
End Sub

Private Sub btnRunQuery_Click()
On Error GoTo Err_btnRunQuery_Click
    Dim stDocName As String
    stDocName = "ddTopic"
    DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_btnRunQuery_Click:
    Exit Sub
Err_btnRunQuery_Click:
    MsgBox Err.Description
    Resume Exit_btnRunQuery_Click    
End Sub