On 16 Jan 2007 14:02:08 -0800, Kyle wrote:
> I have a form on which I placed a button that allows me to print the
> page of the report for the record displayed in the form. When I click
> on the button to print the report page, I get the error "data type
> mismatch in criteria expression". I'm not sure where my code is
> failing, but I know it's in the code; what am I missing?:
>
> Private Sub Print_Memo_Click()
> On Error GoTo Err_Print_Memo_Click
>
> Dim stDocName As String
>
> Dim strRecID As String
> strRecID = "[Event_ID]='" & Me![Event_ID] & "'"
>
> stDocName = "rpt_Detail_Request_Memo"
> DoCmd.RunCommand acCmdSaveRecord
> DoCmd.OpenReport stDocName, acPreview, , strRecID
> DoCmd.PrintOut acPages, 1, 1
>
> Exit_Print_Memo_Click:
> Exit Sub
>
> Err_Print_Memo_Click:
> MsgBox Err.Description
> Resume Exit_Print_Memo_Click
>
> End Sub
>
> Many thanks for any and all help!
What is the datatype of the [Event_ID] field?
You have written the code as though it was Text datatype, but I
suspect [Event_ID] is Number datatype.
strRecID = "[Event_ID]=" & Me![Event_ID]
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
|