I have the following code, which is simply to open a query from a command button. However, I get Type Mismatch error when the code reaches the line in red.
Code:
Private Sub Excel_Time_Click()
On Error GoTo PreviewExcel_Time_Err
If IsNull(Me![TimeCardID]) Then
MsgBox "Enter time card information before previewing the Time Card Query."
Else
[COLOR=red]DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70[/color]
DoCmd.OpenQuery "WorkCode_Crosstab", acPreview, "[TimeCardID]=" & [TimeCardID]
End If
PreviewExcel_Time_Exit:
Exit Sub
PreviewExcel_Time_Err:
MsgBox Err.Description
Resume PreviewExcel_Time_Exit
End Sub