byte vs string?

G

Guest

I have this code I got from mskb article 209560 and I am having a problem with it.
The criteria is set to the Customer ID in the Northwinds DB which is a text data type, the id that I am using is a number, so I recieve a runtime error 3464 message. How di I convert this code to work with a number data type.

Private Sub cmdPrintRecord_Click()

Dim strReportName As String
Dim strCriteria As String

strReportName = "rptPrintRecord"
strCriteria = "[CustomerID]='" & Me![CustomerID] & "'"
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

End Sub
 
D

Dirk Goldgar

"(e-mail address removed)" <[email protected]>
wrote in message
I have this code I got from mskb article 209560 and I am having a
problem with it.
The criteria is set to the Customer ID in the Northwinds DB which is
a text data type, the id that I am using is a number, so I recieve a
runtime error 3464 message. How di I convert this code to work with
a number data type.

Private Sub cmdPrintRecord_Click()

Dim strReportName As String
Dim strCriteria As String

strReportName = "rptPrintRecord"
strCriteria = "[CustomerID]='" & Me![CustomerID] & "'"
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

End Sub

Change this:
strCriteria = "[CustomerID]='" & Me![CustomerID] & "'"

to this:

strCriteria = "[CustomerID]=" & Me![CustomerID]
 

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