Connecting Tech Pros Worldwide Forums | Help | Site Map

How to update records of a form from the combo box

Newbie
 
Join Date: Mar 2008
Posts: 18
#1: Mar 14 '08
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

Expert
 
Join Date: Mar 2008
Location: Firestone, CO
Posts: 112
#2: Mar 15 '08

re: How to update records of a form from the combo box


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
Expand|Select|Wrap|Line Numbers
  1. me.filter = "country= " & comboxname.value
  2. me.filteron = true
  3.  
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.
Reply