Results 1 to 5 of 5
  1. #1
    SFC is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    47

    Report Filter

    I'm trying to create a macro in my report that will filter records when a checkbox is checked in a form.

    My form has a checkbox that when not checked the value is "0"
    When checked the value is "-1"
    the checkbox name is "CheckFabric"

    In my report, I have an event in the header that starts when printing. The event is an embedded macro as follows:
    Attachment 5848



    Budget Report is my table, Extra1 is a value 1 or 0.

    When "CheckFabric" = -1 (is checked), I want to filter the table so only the Records that Extra1 = 0 show.

    Any suggestions is greatly appreciated

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    What is issue - error message, wrong results, nothing happens? I don't use macros, harder to debug.

    You have field in table with a Yes/No value and you want an unbound Yes/No form control to determine whether or not to apply filter to the field?
    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
    SFC is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    47
    Hi June7,
    Thanks for the reply:
    The current issue is that when the filter is being applied (the box is checked) I get a dialog box stating that there is no current record. Then after clicking ok to close the dialog box a number of time, another dialog reads that there is a type mismatch.

    The yes/no value is saved in the table (actually a value of 0 or 1) but the checkbox in the form determines if the filter is applied or not.

    I refer to the form because the people in my office use the runtime version of access and the only can input to the form, then they click a print button which produces the report. I want the checkbox to give them the option of not including a record in the report depending if it is checked.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,972
    I would use VBA code to open report and set filter criteria if chosen. Are any other fields considered in filtering the data?

    In the print button Click event VBA procedure, like:
    DoCmd.OpenReport "reportname", , , IIf(Me.CheckFabric = vbTrue,"Extra1=0","")

    The IIf expression is in the WHERE CONDITION argument.

    Maybe you just need to modify the WHERE CONDITION in the macro. Instead of In ("0") try the =0.
    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.

  5. #5
    SFC is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2011
    Posts
    47
    I will give it a try, although I'm not to confortable with VB

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

Similar Threads

  1. Filter Report
    By BorisGomel in forum Reports
    Replies: 2
    Last Post: 06-09-2011, 03:22 PM
  2. Filter Report By list box
    By BorisGomel in forum Access
    Replies: 1
    Last Post: 04-21-2011, 03:26 PM
  3. Problems with Report Filter
    By eww in forum Programming
    Replies: 1
    Last Post: 10-20-2010, 02:58 PM
  4. Report Filter Problem
    By Imgsolutions in forum Access
    Replies: 2
    Last Post: 07-07-2010, 02:32 PM
  5. How to Filter Report
    By mikel in forum Reports
    Replies: 2
    Last Post: 08-28-2009, 10:11 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