Results 1 to 4 of 4
  1. #1
    Dan9684 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jan 2019
    Posts
    16

    Opening a record based on combo boxes

    Hi everyone,

    Wondering if someone might help me.

    I have a large 'main' table with many fields, including Client, Umbrella, Fund, Month and Share Code. This has a form attached to it. No two records in this main table have the same combination of all five fields

    I also have a menu. On this menu I have five drop down boxes, corresponding to the above five fields, and a button.

    How would I get it so that when a user presses the button on the menu, the record in the form corresponding to the five selections in the drop down boxes appears?

    i.e. if the user selects Client, Umbrella, Fund, Month and Share Code from the five drop downs on the menu, and presses the button, the main form appears at the corresponding record.



    Thanks very much in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    on a form that shows all records, filter the results of the combos:

    build the 'where' clause by cycling thru all the controls....
    it executes after a find button CLICK event
    if null, ignore.
    if not, apply.
    Code:
    '----------------
    sub btnFilter_click()
    '----------------
    dim sWhere as string 
    sWhere = "1=1"
    if not IsNUll(cboST) then sWhere = sWhere & " and [State]='" & cboST & "'"
    if not IsNUll(cboCity) then sWhere = sWhere & " and [city]='" & cboCity & "'"
    if not IsNUll(cboZip) then sWhere = sWhere & " and [ZipCode]='" & cboZip & "'"
    If sWhere = "1=1" Then
      Me.FilterOn = False
    Else
      Me.Filter = sWhere
      Me.FilterOn = True
    End If
    end sub

  3. #3
    Dan9684 is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jan 2019
    Posts
    16
    Sorry you've absolutely lost me there. There is no form that shows all records, only a form that shows one record at a time?

    State,City,ZipCode? Sorry I'm very confused.

  4. #4
    dashiellx's Avatar
    dashiellx is offline Falconer
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Location
    Baltimore
    Posts
    56
    Please review the attached.

    It contains a demo of three ways that a form can be employed to create a dynamic query.

    1) Using Combo Boxes to establish the criteria for the query

    2) Using Multiple Multi-Select List Boxes to establish the criteria for the query

    3) Using Text Boxes to establish date criteria for the query
    Attached Files Attached Files

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

Similar Threads

  1. Report based on combo boxes
    By Shaun in forum Reports
    Replies: 1
    Last Post: 06-29-2016, 11:03 PM
  2. Replies: 9
    Last Post: 06-04-2014, 10:45 AM
  3. Replies: 6
    Last Post: 02-19-2014, 11:11 AM
  4. Replies: 4
    Last Post: 06-28-2012, 08:01 AM
  5. Filter based on two combo boxes.
    By jakeao in forum Programming
    Replies: 1
    Last Post: 05-22-2011, 10:56 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