Results 1 to 6 of 6
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    restrict combo box to option values (Access 2000)

    How can i coordinate the choice in the Option group with the choice in the combo box?
    The form and the combo box have one and the same source, the table TblClients.
    The row source of the combo box is:
    SELECT tblClients.ClientID, tblClients.CompanyName, tblClients.afid
    FROM tblClients
    ORDER BY tblClients.CompanyName;

    What i want is the following.
    If i click the option value 1 in the Option group, the
    row source of the combo box to be :
    SELECT tblClients.ClientID, tblClients.CompanyName, tblClients.afid
    FROM tblClients
    WHERE (((tblClients.afid)=1))
    ORDER BY tblClients.CompanyName;

    If i click the option value 2, to change the row source of the combo box into

    WHERE (((tblClients.afid)=2))

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: restrict combo box to option values (Access 2000)

    In the after Update event of the option group control, use the these code (with appropriate control names):
    <pre>Me.Combo.RowSource = "SELECT tblClients.ClientID, tblClients.CompanyName, tblClients.afid " & _
    "FROM tblClients " & _
    "WHERE (((tblClients.afid)= " & Me.OptionGroup ")) " & _
    "ORDER BY tblClients.CompanyName;"
    Me.Combo.Requery</pre>

    Francois

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: restrict combo box to option values (Access 2000)

    Dear Francois,

    Thank you very much for your email.I beg to be apologized, i was not very clear with what i meant.
    I will try to express myslef more clearly.
    I use the combo box for finding a record and
    displaying all the data for this record.I wanted to restrict the records in the combo box before
    the AfterUpdate event.I do not know if it is possible with combo boxes at all.I want to
    choose an option in the Option Group and when i open the list of the combo box,to see only the
    records from the chosen option.After i have seen the records, i may choose a particular record
    and then display this record.
    I attach the database in order to better explain what i mean.
    If i choose the option 1, it will mean that i must see the clients dummy 1 and dummy 9, since their
    afid is = 1.
    After that i may choose the client dummy 9, and with the AfterUpdate event find this cloient and display all the data for him.
    Also i receove the message Enter parameter value with Me.Office.

    I will be very grateful for your comments.

    Kind regards

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: restrict combo box to option values (Access 2000)

    As you will see in the attachment, the code from my previous post had to be in the after update event of the option group control.
    Francois

  5. #5
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: restrict combo box to option values (Access 2000)

    Dear Francois,

    Thank you for your reply. Of course it all works. As always. I need to apologize to you.You were so clear in writing about AfterUpdate event of the Option group,but somehow that skipped my attention,sometimes i am muddle headed. So thank you for your patience and the good solution i had received

    I wish you all the best

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: restrict combo box to option values (Access 2000)

    No need to apologize, we all overlook something sometime <img src=/S/newbrain.gif border=0 alt=newbrain width=21 height=22>
    Francois

Posting Permissions

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