Re: Select Current Record for Report

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: depawl (depawl_at_netzero.net)
Date: 03/25/04


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



Relevant Pages

  • Re: Daily breakdown per week
    ... The error message is "Syntax Error in LEFT JOIN operation". ... "Tom Ellison" wrote: ... there may be days when an employee does not work. ...
    (microsoft.public.access.queries)
  • Re: MsgBox Err.description
    ... MsgBox "There are no more records for this employee." ... How do I change it so it displays a custom error message? ... Private Sub Next_Record_Click ...
    (microsoft.public.access.modulesdaovba)
  • Re: Variable variable name
    ... numbers first) in a shell script: ... I get the following error message: ... quote the command to prevent filename expansion on the first ... Thanks for your reply, Chris. ...
    (comp.unix.shell)
  • Re: Installation of Blackbox
    ... very much for Chris). ... enough memory allocation for bash. ... error message didn't appeared anymore. ... I succeeded the Chris Double's tutorial of installation wmii. ...
    (comp.os.minix)
  • Re: "Document is already open" Message
    ... Type "winword.exe/regserver" without the quotes and click on OK. ... Whenever I double click on a MSWord document it opens ... >error message indicating that the document is already open, ... >can't open two documents with the same name, blah blah blah. ...
    (microsoft.public.office.misc)