G
Guest
I'm trying to print only the current record on a One to Many form where
tblClasses is the Parent table. The Primary Key is ClassNo which is a TEXT
field.
Every time I click the button to print preview the current record, I receive
the following error message:
Data Type Mismatch in Criteria Expression
---------------------------------------------------------------------------------------
Here's the code behind the command button.
Note: I've tried using a period and ! before ClassNo and it had no effect.
Private Sub cmdTestRpt_Click()
On Error GoTo Err_cmdTestRpt_Click
Dim strDocName As String
Dim strWhere As String
strDocName = "rptClassesTEST"
strWhere = "[ClassNo]=" & Me.ClassNo
DoCmd.OpenReport strDocName, acViewPreview, , strWhere
Exit_cmdTestRpt_Click:
Exit Sub
Err_cmdTestRpt_Click:
MsgBox Err.Description
Resume Exit_cmdTestRpt_Click
End Sub
tblClasses is the Parent table. The Primary Key is ClassNo which is a TEXT
field.
Every time I click the button to print preview the current record, I receive
the following error message:
Data Type Mismatch in Criteria Expression
---------------------------------------------------------------------------------------
Here's the code behind the command button.
Note: I've tried using a period and ! before ClassNo and it had no effect.
Private Sub cmdTestRpt_Click()
On Error GoTo Err_cmdTestRpt_Click
Dim strDocName As String
Dim strWhere As String
strDocName = "rptClassesTEST"
strWhere = "[ClassNo]=" & Me.ClassNo
DoCmd.OpenReport strDocName, acViewPreview, , strWhere
Exit_cmdTestRpt_Click:
Exit Sub
Err_cmdTestRpt_Click:
MsgBox Err.Description
Resume Exit_cmdTestRpt_Click
End Sub