How to update records of a form from the combo box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hulas
    New Member
    • Mar 2008
    • 18

    #1

    How to update records of a form from the combo box

    Finally I made up my mind to give up and ask you guys for help. I have a combo box which I want to update its corresponding records as I make the selection. For example I have a combo box that has list of different countries and its attributes are state, city, zip code etc. Now if I select the country name from the combo box I want its attributes to update. Right now what I am doing is I am selecting the country name and than I am hitting filter selection. But, I am sure there's an easy way.

    Thank you for considering my request.
    Hulas
  • janders468
    Recognized Expert New Member
    • Mar 2008
    • 112

    #2
    what you need to do is place some code in the on_change event of the combo box. Although there are other ways I believe this is the easiest, assuming that you are working with a data bound form. Simply update the form's filter property in the on_change event of the combo box. If that makes sense do it, otherwise follow the steps below:
    1. With the form in design view double click on the combo box.
    2. Go to the event tab.
    3. Select Event Procedure from the drop down box of the on change category.
    4. Click the button with the three dots (next to the box that says [event procedure])
    5. In between the sub end sub marks place the following code
    Code:
    me.filter = "country= " & comboxname.value
    me.filteron = true
    If country isn't what the query or table field is named, then use whatever the name is in the data source. if it is more than one word surround with square brackets.

    Comment

    Working...