Printview - debug error

L

LHEMA

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
Opening report 4
Working outlook via vba code with xlsx - error 0
Printing Report 3
Print multiple reports 6
Report VB Code 1
Print Current Record 9

Top