E
Emma
Using the following code to open a report based on the
current records Accounting_Reference_No, I'm getting an
error "Data type mismatch in criteria expression". Can
anyone tell me why?
Private Sub Print_Sponsorship_Consulting_Request_Click()
On Error GoTo
Err_Print_Sponsorship_Consulting_Request_Click
Dim strDocName As String, strLinkCriteria As String
'if Request Type is 1 then print the current record
Sponsorship Form
If Request_Type_Frame = 1 Then
strDocName = "Rpt_Sponsorship_Request"
'select only the current form accounting reference number
to the report accounting reference no.
strLinkCriteria = "[Accounting_Reference_No]
= " & Me![Accounting_Reference_No]
DoCmd.OpenReport strDocName, acViewPreview, ,
strLinkCriteria
Else
'if Request Type is 2 then print the current record
Consulting Form
If Request_Type_Frame = 2 Then
strDocName = "Rpt_Consulting_Request"
'select only the current form accounting reference number
to the report accounting reference no.
strLinkCriteria
= "[Accounting_Reference_No] = " & Forms!Frm_Request!
[Accounting_Reference_No]
DoCmd.OpenReport strDocName,
acViewPreview, , strLinkCriteria
End If
End If
Exit_Print_Sponsorship_Consulting_Request:
Exit Sub
Err_Print_Sponsorship_Consulting_Request_Click:
MsgBox Err.Description
Resume Exit_Print_Sponsorship_Consulting_Request
End Sub
Thanks,
Emma
current records Accounting_Reference_No, I'm getting an
error "Data type mismatch in criteria expression". Can
anyone tell me why?
Private Sub Print_Sponsorship_Consulting_Request_Click()
On Error GoTo
Err_Print_Sponsorship_Consulting_Request_Click
Dim strDocName As String, strLinkCriteria As String
'if Request Type is 1 then print the current record
Sponsorship Form
If Request_Type_Frame = 1 Then
strDocName = "Rpt_Sponsorship_Request"
'select only the current form accounting reference number
to the report accounting reference no.
strLinkCriteria = "[Accounting_Reference_No]
= " & Me![Accounting_Reference_No]
DoCmd.OpenReport strDocName, acViewPreview, ,
strLinkCriteria
Else
'if Request Type is 2 then print the current record
Consulting Form
If Request_Type_Frame = 2 Then
strDocName = "Rpt_Consulting_Request"
'select only the current form accounting reference number
to the report accounting reference no.
strLinkCriteria
= "[Accounting_Reference_No] = " & Forms!Frm_Request!
[Accounting_Reference_No]
DoCmd.OpenReport strDocName,
acViewPreview, , strLinkCriteria
End If
End If
Exit_Print_Sponsorship_Consulting_Request:
Exit Sub
Err_Print_Sponsorship_Consulting_Request_Click:
MsgBox Err.Description
Resume Exit_Print_Sponsorship_Consulting_Request
End Sub
Thanks,
Emma