Printview - debug error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

For some odd reason my printview button on my form does not work, I get a
debug error telling me to check the macros...this is what I have for the code:
Private Sub Print_Preview_Click()
Dim strWhere As String

If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If

If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[employeeID#] = """ & Me.[EmployeeID#] & """"
DoCmd.OpenReport "Employee Accidents", acViewPreview, , strWhere
End If
End Sub

Any help is appreciated, Thanks
 
If employee# is a Number type field (not a Text type field), lose the extra
quotes:
strWhere = "[employeeID#] = " & Me.[EmployeeID#]

If that does not solve the problem please give the error number and text.
 
Back
Top