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
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