By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,426 Members | 2,928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,426 IT Pros & Developers. It's quick & easy.

How to update records of a form from the combo box

P: 18
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.
Mar 14 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 112
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
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.
Mar 15 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.