Re: Select Current Record for Report
From: depawl (depawl_at_netzero.net)
Date: 03/25/04
- Next message: anonymous_at_discussions.microsoft.com: "Re: Access form field won't allow data entry"
- Previous message: Joel: "Re: Repost Ordering in forms"
- In reply to: Chris Large: "Select Current Record for Report"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Mar 2004 20:40:06 -0500
OK Thanks Chris.
That took care of the error message. However, the code doesn't seem to
do what I intended it to do. I wanted it to print a report for only the
record that a user selects in a combo box on the form, but the report it
generates seems to be only the first record in the report's underlying
query. I don't seem to be able to get it to print only the record that I
want.
Any ideas?
Chris Large wrote:
>You need quotes around the string. When you enter criteria
>in the Query design grid Access puts the quotes around any
>text you enter, but from code you must do this yourself.
>Change to the following:-
>
>strWhere = "[EMPLOYEENAME]=""" & Me!EMPLOYEENAME & """"
>
>note that you need to doubled the quotes when used inside
>other quotes.
>
>hth
>
>Chris
>
>
>
>>-----Original Message-----
>>I have a combo box on a form with a list of employee
>>
>>
>names. When the
>
>
>>user selects an employee from this combo box, I want it
>>
>>
>to open a report
>
>
>>of the selected record with info on the selected employee
>>
>>
>only.
>
>
>>I have the following code in the After Update event of
>>
>>
>the combo box:
>
>
>>Dim strDocName As String
>>Dim strWhere As String
>> strDocName = "EmployeeReport"
>> strWhere = "[EMPLOYEENAME]=" & Me!EMPLOYEENAME
>> DoCmd.OpenReport strDocName, acPreview, , strWhere
>>
>>But when I run it I get the following error message:
>>Syntax error (missing operand) in query
>>
>>
>expression '([EMPLOYEENAME]=
>
>
>>John Doe)'
>>
>>What am I missing?
>>Thanks.
>>
>>.
>>
>>
>>
- Next message: anonymous_at_discussions.microsoft.com: "Re: Access form field won't allow data entry"
- Previous message: Joel: "Re: Repost Ordering in forms"
- In reply to: Chris Large: "Select Current Record for Report"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|