Print Single Record

esskaykay

Registered User.
Local time
Today, 18:47
Joined
Mar 8, 2003
Messages
267
I posted this question a while ago and received a great response. It works fine. However, when I tried using it in a different DB I received a data mismatch error. I believe it's because the code is writen for a number field. My new DB has a text field. I assume the code has to be modified slightly for text (or date)

My Code:
Private Sub PrintIt_Click()
On Error GoTo Err_PrintIt_Click

Dim stDocName As String

DoCmd.RunCommand acCmdSaveRecord

stDocName = "rptPermit"
DoCmd.OpenReport stDocName, acNormal, , "[ID] =" & Forms!frmStorm_Erosion!id


Exit_PrintIt_Click:
Exit Sub

Err_PrintIt_Click:
MsgBox Err.Description
Resume Exit_PrintIt_Click

End Sub

Suggestions?

Thanks,
SKK
 
Try the following:

DoCmd.OpenReport stDocName, acNormal, , "[ID] =" & Chr(34) & Forms!frmStorm_Erosion!id & Chr(34)

Since it is a text now instead of a number, it must be treated as a text.
 
That did it. Thank you very much.

SKK
 

Users who are viewing this thread

Back
Top Bottom