Results 1 to 3 of 3
  1. #1
    rck3 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2012
    Posts
    24

    Open Report by Combo box


    Ok, so as I figure out one issue I run into another but I am getting closer. Database is complete but I am working on reports. I have several reports complete which pull all data. I am now trying to include a filtered report and not sure where I am going wrong. Any help would be great!

    I have a form created with a combo box that lists all options for a field PW_Filter. Once selected I want the report to open with it filtered showing only those that match the PW_Filter field. With the command below when I select an option from the dropdown it opens up an access window (instead of just opening the report) asking for the PW_Filter value. If I type in a value that matches my report opens fine, but I dont know why it is not passing the PW_Filter selection on instead of then asking for it to be entered. In the below my report is Time by Project Worksheet, Project worksheet is the report field to be filtered, and PW_Filter is the options in my combo box. What am I missing? Thanks everyone

    DoCmd.OpenReport "Time by Project Worksheet", acViewPreview, , "[Project worksheet] = 'PW_Filter"

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,960
    Concatenate variables. Treat reference to control on form or field of form RecordSource same as a variable. Is PW_Filter also name of combobox?

    DoCmd.OpenReport "Time by Project Worksheet", acViewPreview, , "[Project worksheet] = '" & Me.PW_Filter & "'"

    Is [Project worksheet] a text field? If not, remove the apostrophe delimiters. Date fields use # symbol.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    rck3 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Apr 2012
    Posts
    24
    Thanks, I never did much in access before but understood programming in other languages. Just trying to get down those minor syntax issues. Works now and applied it to my other filters. Should be all set! You can mark it resolved.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 09-21-2011, 03:21 AM
  2. Using a combo box to open a report
    By Bill Casanova in forum Forms
    Replies: 24
    Last Post: 05-24-2011, 10:42 AM
  3. A Combo box that open another form
    By mar_t in forum Access
    Replies: 14
    Last Post: 01-09-2011, 10:53 PM
  4. Combo box open reports
    By GUMUBIBI in forum Programming
    Replies: 5
    Last Post: 09-06-2009, 04:36 PM
  5. Using combo box to open another form
    By ladyairj23 in forum Forms
    Replies: 0
    Last Post: 06-02-2006, 07:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums