Results 1 to 11 of 11
  1. #1
    Join Date
    Jun 2008
    Posts
    23

    Unanswered: Combo Box not Populating Forms

    I have Combo box in a form as a search criteria to pull customer information from the Customer information and populate the form. The combo box will populate with the customer name, but will not populate form with customer information, rather what will appear in the form is the first record in the table and will not change even if you choose another customer. For example I have a table tblCustomer with customer information:
    CustomerID, FirstName, LastName, Address, LicenseNo, Phone. These are records in the form that are suposed to be fill once the customer name is selected from the combo box.when I chose a particular customer name.

    I used SELECT tblCustomer ........ to populate the combo box.

    Is there something I am doing wrong here.

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Obviously there is something you're doing wrong or it would be working!

    What are you doing after updating the combo box?
    Is it a bound form or unbound?

    If it's a standard bound form, you just need to put in something to tell the form to get the customer you select. Set the Record Source of the form to something like:

    "SELECT * FROM tblCustomer WHERE CustomerID = " & Me.ComboBoxName

    Do that After Updateing your combo box and you should be off and running
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Jun 2008
    Posts
    23
    I forgot to mention that this is an unbound form. Any suggestion.

    Thanks for your help

  4. #4
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    And you forgot to mention what you are currently doing after updating the combo box.

    With an unbound form, you just apply the SQL I mentioned to your current process of fetching data to populate the form.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  5. #5
    Join Date
    Jun 2008
    Posts
    23

    Combo Box/Form Problem

    I am lost. Here is the code in my combo box after-update. Where should the SQL statemen be placed. I tried it but did not work "

    Private Sub cboSelect_AfterUpdate()
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[ProviderID] = " & Str(Nz(Me![cboSelect], 0))
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark

    End Sub

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    That's what I wanted to see

    Now I can see more of what's going on. Try this:

    Code:
    Private Sub cboSelect_AfterUpdate()
       ' Find the record that matches the control.
       Me.RecordSource = "SELECT * FROM tblCustomer WHERE CustomerID = " & Me.cboSelect
    End Sub
    That "binds" the form though, but I want to see if this is a sufficient solution for you
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Jun 2008
    Posts
    23
    StarTrekker, you are the God of Access. Works great. Kudos to you. I hihly appreciate your help.

  8. #8
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049


    You're most welcome
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  9. #9
    Join Date
    Jan 2008
    Posts
    114

    Talking How to..

    Hello StarTrekker

    Long time no moither.....

    Just looking at this bit of code... excellent solution for what I have been trying to do for days BTW....

    How could I add a where clause to it?
    Private Sub cboSelect_AfterUpdate()
    ' Find the record that matches the control.
    Me.RecordSource = "SELECT * FROM tbl:Client WHERE Firstname = " & Me.cboSelect
    WHERE ClientIsCurrent = yes
    End Sub


    And how the heck do you make a combobox alphabetical?
    Thank you

    Tracy

  10. #10
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    syntax of SQL statement...
    Code:
    SELECT list, of, comma, separated, column, names, not, the, dreaded, select, star
    FROM   tablename
    WHERE  firstname = 'george'
    AND    username = 'georgev'
    As for ordering the combobox - add an ORDER BY clause to the recordsource/rowsource.
    George
    Home | Blog

  11. #11
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    ▲ Like that
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

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