data type mismatch

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

Guest

I want to print only the current record bur Access tells me the following:
"Runtime error 3464
Data type mismatch in criteria expression"

I am using the following code on a command button on my form.

I want to print from Labels Contacts1.

Dim strDocName As String
Dim strWhere As String
strDocName = "Labels Contacts1"
strWhere = "[JobTitle]=" & Me!JobTitle

Any help would be appreciated.

Thanks
DoCmd.OpenReport strDocName, acPreview, , strWhere
 
The JobTitle field is obviously Text type, so you need to treat it
appropriately, by enclosing Me!JobTitle in quotes. Change the particular
line of code to:

strWhere = "[JobTitle]='" & Me!JobTitle & "'"

HTH,
Nikos
 
Back
Top