Results 1 to 7 of 7
  1. #1
    RobFlott is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2015
    Posts
    22

    Question How to create a Form with one Combo Box that displays selected Fields from a Table

    I have a Table with 5 Fields of sales data and am trying to create a Form that has one ComboBox from which the user selects one person (Field 1). Upon selection all the Fields with data relative to the selected name appears below the ComboBox.

    I know this can be done using a 'Datasheet' Form and letting the user simply filter on the Name field, but I want to see if I could accomplish the same results using the ComboBox on a Form.

    Please let me know if this can be done and if so how do I set this up.



    Thank you

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Use a continuous record form, (not datasheet) with the combo in the form header.
    when the user picks a person , filter the records...
    Code:
    sub cboPerson_Afterupdate()
       me.filter = "[personID]=" & cboPerson
       me.filterOn = true
    end sub

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Controls on Continuous form can be arranged to look like Datasheet.
    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.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Returning only a single Record, I'm not really sure why a Datasheet Form or a Continuous Form would be appropriate. You can let the Combobox Wizard do this for you:

    If you haven't already done so, create a Form based on your Table, including all the Fields you want displayed.

    Then simply:

    • Add a Combobox to your Form.
    • The Combobox Wizard will pop up
    • Select "Find a record based on the value I selected in my combobox."
    • From the Table the Form is based on, click on the Field you're searching by (a Field that is unique for each Record) to move it to the right side.
    • Hit Next.
    • Size the column appropriately.
    • Hit Next.
    • Name the Combobox something appropriate.
    • Hit Finish.

    Now you can drop the Combobox down and scroll down to the item to search by, or you can start to enter the item and the Combobox will "autofill" as you type. Hit <Enter> and the Record will be retrieved.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    RobFlott is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2015
    Posts
    22
    ranman256,

    Thank you for the quick response. I tried your suggestion but I'm doing something wrong and I cannot figure it out.


    Where your code reads: me.filter = "[personID]=" & cboPerson does personID refer to the name of the Field? In my case the Field name is Manager, and I named the ComboBox cboManager.

    So my code looks like this:

    Private Sub cboManager_Afterupdate()
    me.filter = "[Manager]=" & cboManager
    me.filterOn = true
    End Sub

    But nothing happens when I make a selection from the Combo Box.

  6. #6
    RobFlott is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2015
    Posts
    22
    MissingLing,

    Thank you very much.

    I followed your suggestion and this worked.

    Thanks again

    Rob

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Glad we could help!

    Welcome to AFN!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Replies: 4
    Last Post: 03-09-2015, 06:49 AM
  2. Replies: 1
    Last Post: 08-08-2014, 08:27 AM
  3. Replies: 6
    Last Post: 11-18-2013, 04:50 PM
  4. Replies: 1
    Last Post: 10-11-2013, 10:05 PM
  5. Replies: 0
    Last Post: 03-08-2011, 05:56 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