Access 2000: How to print a single record from a form in a report

N

newtec_54

Hi, I downloaded this page from the Microsoft help page and wrote it into the
code for the command button as instructed. When I click on the print button I
get this error message;

Run-time error '3464'
Data type mismatch in criteria expression.

The event procedure is this:

Private Sub cmdPrintRecord_click

Dim strReportName As String
Dim strCriteria As string

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

End Sub

When I run debug DoCmd line is highlighted.
Can anyone enlighten me to the cause and give a solution?
 
T

Tom Lake

newtec_54 said:
Hi, I downloaded this page from the Microsoft help page and wrote it into
the
code for the command button as instructed. When I click on the print
button I
get this error message;

Run-time error '3464'
Data type mismatch in criteria expression.

The event procedure is this:

Private Sub cmdPrintRecord_click

Dim strReportName As String
Dim strCriteria As string

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

End Sub

When I run debug DoCmd line is highlighted.
Can anyone enlighten me to the cause and give a solution?

If the ApplicationID field is numeric, don't use the single quotes.
Do this:

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

Tom Lake
 

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