Results 1 to 9 of 9
  1. #1
    Join Date
    Aug 2004
    Posts
    34

    Unanswered: Use combo box for query criteria

    I have a form that prompts user to enter carrier #. We are constantly adding new carriers and users don't know of all the carrier #'s. Is ther a way to allow users to select a carrier form a combo box/list? I am a newbie and really appreciate anyone who can give me some direction

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Poke around the Help file for combo box recordsource. It's fairly trivial to assign a record source to a combo box.

    IN general, you can reference objects on a form from a query or a report using:

    Forms!YourForm!YourObject.value
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Aug 2004
    Posts
    34
    I guess I didn't describe my situation enough..I have a form with the record souce being a SQL Statement:Query builder. On one of the fields i have criteria = [Enter Carrier Number] As iI stated before, I reall want the form to open and allow user to select Carrier Name from combo box or list to update all other fields. That's what I'm trying to do, maybe I'm going about it all wrong but I am trying to learn on the fly.

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    If I understand you correctly then you will want to add a combo box to the form. When the wizard comes up, tell it to make a combo box that searches for a record. The wizard will create the code to find the carrier for you when the user selects a carrier.

  5. #5
    Join Date
    Mar 2004
    Posts
    42
    Change your field on your form into a combo or list box then on the record source type change it to Table/Query then bind it into a table or query on the record source. You should have your value in the a table if you want to add additional value later. This is the simple way to do it.

    ESM

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Quote Originally Posted by esm
    Change your field on your form into a combo or list box then on the record source type change it to Table/Query then bind it into a table or query on the record source. You should have your value in the a table if you want to add additional value later. This is the simple way to do it.

    ESM
    If you're feeling sassy and adventurous you could go the vba route and put a little code in the after update event of the combo box:

    me.filter = "id = " & me.YourComboBox.Value
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  7. #7
    Join Date
    Aug 2004
    Posts
    34
    I have the combo box on my form. What I would like to happen is when the user selects a carrier in the combo box, the other fields on my main form update base on the selection, address,State, zip ect.. the tricky part is having the data in the sub-form also update base on theat selection. Any ideas

  8. #8
    Join Date
    Jul 2004
    Location
    Inverurie
    Posts
    628
    Going with Teddy's suggestion, you could also add vba code to requery the subform that should already be based on that table (using the After Update event). You can also set the fields that you want to be based on the same query, but only display the details that you want to show.

    It should come off ok.

  9. #9
    Join Date
    Aug 2004
    Posts
    34
    Thanks..the combo box works great..but my subform isn't working. The subforms data is coming from a different table. My main form is carriers and my sub form is carrier contacts. By selecting in the main form combo the carrier name, I want the subform to update with the contacts for that carrier. Both tables have carrier number and I am using that for the relationship. Its a one-to-many. Any ideas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •