byte vs string?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
"(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]
 
Back
Top