data type mismatch

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
 
N

Nikos Yannacopoulos

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
 

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

Top