Results 1 to 6 of 6
  1. #1
    EddieN1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2011
    Posts
    313

    Combo Box using RecordsetClone


    I have a continuous form with the list of records filtered based on the Operator's selection controls. When the Operator selects the desired filters, I reconstruct the sql code for the RecordSet and update Me.RecordSet. I want another combo box to limit the listed rows to the filtered RecordSet... perhaps using a RecordsetClone property?

    Thanks, Eddie

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    No, not with RecordsetClone.

    What you describe is a conditional or cascading combobox. Set the combobobx RowSource SQL with same filter criteria applied to form.
    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
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Sounds more like a search form to me (maybe with cascading combos, maybe not) but the form recordset needs to be a sql statement that makes use of the selected combo items and/or textboxes. Perhaps create the sql using something like a commandbutton click event and set the form recordsource property to it.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Seems like you just need to add that 2nd combo box to the sql line filter for RowSource? Probably do a IF/Then like:

    If ComboBox1 <> null then
    If Combobox 2 <> null then
    subform.RowSource = Select * From YourTable Where field1 = Combobox1 and field2 = Combobox2
    Else
    subform.RowSource = Select * From YourTable Where field1 = Combobox1
    End If
    Else
    If Combobox 2 <> null then
    subform.RowSource = Select * From YourTable Where field2 = Combobox2
    End If
    End If

  5. #5
    EddieN1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2011
    Posts
    313
    Hey guys, thanks for all the input, however, I have come up with a solution that other might use. When the routine that builds the sql for Me.RecordSource, I save the part of the sql that contains the Tables (FROM xxx INNER JOIN yyy, etc.) and the WHERE/AND clauses. Then in the Selection Combo boxes Enter Events, I update the field's RowSource with a custom SELECT DISTINCT clause using the same field names that are in the form's RecordSource, followed by the saved "FROM xxx INNER JOIN yyy WHERE zzz AND AAA, etc." sql string and then the custom ORDER BY fields. Works like a charm. Thanks again.

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Your description is very confusing - suggest show some example data and the outcome required

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

Similar Threads

  1. Recordset bombs, RecordsetClone works
    By pdanes in forum Forms
    Replies: 21
    Last Post: 11-16-2021, 11:33 AM
  2. A2003 - Me.RecordsetClone.MoveLast not working
    By GraeagleBill in forum Programming
    Replies: 3
    Last Post: 05-25-2016, 08:52 PM
  3. Replies: 2
    Last Post: 10-21-2014, 07:57 AM
  4. Recordsetclone NOT picking up records from linked table
    By CementCarver in forum Programming
    Replies: 1
    Last Post: 10-15-2013, 10:01 AM
  5. Replies: 1
    Last Post: 07-02-2013, 08:41 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