Results 1 to 6 of 6
  1. #1
    oica72 is offline Novice
    Windows XP Access 2002
    Join Date
    Nov 2011
    Posts
    2

    Generating Report from Form filtering

    Hi,
    My database contain one table, one form and one report.
    I want to filter the data on the form by using a combo box and a list box and then, after pressing command button Print, I want to generate a report with the filtering data.


    Thank you in advance

  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,929
    Try:

    1. set criteria in report RecordSource that refers to the controls on form as input parameters

    or

    2. use WHERE argument of DoCmd.OpenReport:
    DoCmd.OpenReport reportname, , , "fieldname1='" & Me.comboboxname & "' AND fieldname2='" & Me.listboxname & "'"
    If data is number remove the apostrophe delimiters, if dates use # delimiters.
    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
    dblife's Avatar
    dblife is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Nov 2011
    Location
    South Shields, UK
    Posts
    104
    Or you could base your report on a select query and have the criteria for the select query as the combo on the form?
    Either method will work but this method ties your report to this form.
    June7's method keeps your form free for use by other forms.

  4. #4
    oica72 is offline Novice
    Windows XP Access 2002
    Join Date
    Nov 2011
    Posts
    2
    Dear June7,
    Could you please help in this particular example? I tried to implement your advice but I failed

    Thanks in advance

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Which method do you need help with? What did you try to implement? Why didn't it work - error message, wrong results, nothing happened?

    For #1, check this tutorial http://datapigtechnologies.com/flash...tomfilter.html

    I can't view your database for 2 weeks (vacation).
    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.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Problem appears to be the search criteria are dates but you have formatted the search for text string. Review the attached modification of your project. I will remove the file after you respond or in a few days.

    EDIT: purpose served, file removed.
    Last edited by June7; 03-22-2012 at 12:41 AM.
    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.

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

Similar Threads

  1. Replies: 6
    Last Post: 08-22-2011, 06:52 PM
  2. Replies: 0
    Last Post: 03-23-2011, 11:29 PM
  3. Generating report from fields chosen in a form
    By kroenc17 in forum Reports
    Replies: 19
    Last Post: 10-01-2010, 10:38 AM
  4. Form using requerys and report generating
    By kroenc17 in forum Forms
    Replies: 1
    Last Post: 09-22-2010, 07:12 AM
  5. Generating Report from Form
    By mwabbe in forum Reports
    Replies: 8
    Last Post: 08-30-2010, 12:25 PM

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