Printview - debug error

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
 
A

Allen Browne

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Print Preview error 12
Print the record in the form 1
Printing Report 3
Trouble with the following 4
HELP with Print Current Record 2
Print Current Record 9
Print multiple reports 6
Print single report 8

Top