Results 1 to 8 of 8
  1. #1
    Kipandrews06 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    54

    Need to have a report filter records from a split form

    I have a split form called "frmSearchWO" that I use as a "search criteria" form for users to filter records based off of whatever criteria they specify. I have multiple combo and text boxes setup in the form header to use as filters. I have a report called "Work Orders Criteria Search" that has the same record source as the split form from a query, but I am having trouble getting the report to only show the filtered records from the search form. It opens up just fine but keeps displaying all the records and won't filter to what is currently displayed on the datasheet part of the splitform. Any ideas how I can fix this? I've tried: DoCmd.OpenReport "Work Orders Criteria Search", acViewPreview, Me.Filter and no luck. Any help would be much appreciated!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    put it in the WHERE condition (extra comma)

    DoCmd.OpenReport "Work Orders Criteria Search", acViewPreview, ,"[field]='" & txtBox & "'"

  3. #3
    Kipandrews06 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    54
    I just tried that and no luck. It asks for a parameter value for "field". I forgot to mention this but I am wanting to generate this filtered report from a command button that says "Generate Report" on the split form. I don't know if that makes a difference or not.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    [field] is your field name. txtbox is your txtBox name.
    This is why I answer with the likes of [yourFieldNameHere] but even that is no guarantee of clarity.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    You need the filter as the correct argument?
    https://docs.microsoft.com/en-us/off...cmd.openreport
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    Kipandrews06 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    54
    Ok, please bear with me, I'm pretty new to access still and been trying to learn on the fly so I apologize in advance if I ask any stupid questions lol. But if I want all the fields that are displayed on my datasheet part of the split form, would I use [ID] for the field name? and the textbox that's in the form header, I also have several combo boxes too to filter records on the form. How would I list those? because some or all but one of the text boxes and combo boxes may be null or several of them may have criteria listed in them. For example, if a user got on the form and they wanted to search by location only and none of the other criteria, it will filter the records based on the location they selected, but if another user got on and wanted to search By Date and By Cost then it would filter records based on that. And for the report, I want it to display the records they filtered from the splitform. But I'm confused how I would go about stipulating all the combo and text boxes because like in the example I mentioned if I used the "Location" text box in the code, then it would only filter for location and exclude any other criteria combo or text boxes. And if I want all the fields displayed how do I specify?

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    No, I would use the form filter.
    Debug.Print it to see what it is, but you have it in the incorrect place I believe. You need it in the WHERE location, which is the next argument, so place another , between acViewPreview and Me.Filter
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    Kipandrews06 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Posts
    54
    AAAHAAA!!!!! You're a genius! that did the trick and works great now! I can't believe I've been stuck this long on this thing and tried a million different things and all along I just needed an extra comma lol. Thank you all very much for the help!

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

Similar Threads

  1. Quick Filter in Split Form
    By pmangan in forum Access
    Replies: 7
    Last Post: 10-25-2017, 02:09 PM
  2. How do I filter my split form?
    By lccrews in forum Access
    Replies: 1
    Last Post: 09-26-2017, 10:38 AM
  3. Filter Button on Split Form
    By data808 in forum Access
    Replies: 4
    Last Post: 02-14-2015, 12:35 AM
  4. Filter Split Form using listboxes
    By Delta729 in forum Access
    Replies: 2
    Last Post: 01-06-2015, 10:59 PM
  5. Filter or FindRecord in Split Form
    By P5C768 in forum Forms
    Replies: 4
    Last Post: 03-20-2012, 12:16 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