Log in

View Full Version : Adding customer


jduke44
Mar 29, 2006, 05:38 PM
I have been learning and building an ms access database. There version is 2002. I have all my tables built and the forms built. I wanted to be able to add a customer so that it would get included in a drop down box. I can add it the problem is I have to close the form and reopen it so I can see it in the list. Would I have to add code to get this to update automatically or is there something within the properties? Thanks.

ScottGem
Apr 4, 2006, 06:36 AM
You need to requery the combobox after you add the customer. The code would be:

Me.comboboxname.requery

But where you put it depends on your work flow.

jduke44
Apr 7, 2006, 03:04 PM
Scott, thanks for responding. As you know I am just learning Access so bare with me. I uderstand I am vague in what my project is but when you say to add the code you provided are talking to place it in an event procedure?

If so what would be my choices? Would I add it under the event tab where it has After Update and so forth. The I would want to build a code? I tried it in different places but it didn't work. I want to learn this on my own (with a little help) so doing it wouldn't be beneficial but if you point me in the right direction, I'm sure I can figure it out. Thanks for your time.

ScottGem
Apr 7, 2006, 07:01 PM
Access is an event driven platform. Code is triggered by events like the update of a control the press of a button, etc. You need to look through the flow of how you are adding a new customer. Somewhere after you add the customer to the table, you need to requery the combo.

jduke44
Apr 7, 2006, 07:48 PM
Scott, I think I figured it out thanks to you. After placing the code in various events it worked under the "on Got Focus " event. So I assume once the combobox received control it would requery. I think I am understanding it a little. I might have more questions later. Thanks for your help.

ScottGem
Apr 8, 2006, 05:00 AM
The Got Focus event was certainly a possibility. There were probably a couple of different places you could have put it and have it work.

jduke44
Apr 11, 2006, 05:57 PM
It works and I'm happy. As I learn Access I'll hopefully find the more efficient way of doing things. That is if I do any more databases. It's been somewhat fun learning this. I'll probably have more questions in the future. Thanks for your help.

ScottGem
Apr 12, 2006, 05:14 AM
Glad to assist