Simple Question On Combo Box Update

Garindan

Registered User.
Local time
Today, 16:50
Joined
May 25, 2004
Messages
250
Sorry to be a pain everyone, i have an idea of what i need to do but after an hour of looking through posts i can't quite get my head round it.

I have a form which uses combo boxes on a couple of fields. Take the field 'Town' as an example, the user can select from the list of towns already entered, or if it's not there, enter a new one. Simple.

But if the user goes to a new record and tries to enter the same town, it's not in the list yet. You have to close the form and re-open it for it to be in the list.

So i know its simple, but i'm just learning, sorry. Could someone explain what i need to do to have the combo box update, either when the focus goes onto another field, or preferably when the user goes to the next record/previous record, etc.

Many thanks in advance :)
 
G,

Use the Search Facility here and look for "NotInList". It will show you
how to handle it when users enter a new value in a combo. Basically,
you have to .ReQuery the combobox.

Wayne
 
Sorry mate, but i've looked for another hour or so this morning, and i can't find anything. At least, i can't find anything which i can understand. Can anybody show me how to do it?
I'm not even sure how to enter code into an event property, e.g., if i go to the NotInList event of the combobox and choose code builder, open visual basic, then how do i put the code needed back into the event property?
I've not learnt much of the 'code' side of things yet. :(
 
demo not in list

hello
check the attach file and in products field enter new field hope this helps.
 

Attachments

mkkashif - Thanks for your help. Unfortunately that seems a bit complicated for what i want. I simple want to Requery the combo box/table so the entries are updated without having to close and reopen the form. Trouble is i can't work out how to do it. As i said, i'm knew to coding :(
 
Thanks Pat. Sorry to be a real pain, but how do i make sure that is entered properly? If i just type it in the AfterUpdate property of the combo box, access produces an error which says something like 'access can't find the macro', if i choose event procedure and put the code in the visual basic editor nothing seems to happen, it won't work.

Sorry again :o
 
Enter the exiting world of Access programming ;)

On the property line, at the right, there's a button with three dots, hit it, select Code Builder, and anter Pat Hartman's code between the Private sub... and End Sub lines.

Substitute "YourCombo" with the name of your combo
 
Right okay, i've tried that, i have tried it in the AfterUpdate, BeforeUpdate, NotInList, and LostFocus fields one after the other. I choose code builder, i type the line in between the private sub and end sub lines, then close the window, save the form, if i go back and look at it its all there correctly, and i know i'm entering the combo box name fine..... but it doesn't want to work? Any idea's?

It's a customer details form, the whle thing (form and database in general) works perfectly and has been in use for a while, apart from code i have no problems with creating a working database, but it doesn't want to work :( The reason for doing this is that the person who is using the database wants to be able to enter a bit of new data, e.g. a street name, and then go onto the next record and straight away be able to choose that street name from the list, as he often is entering a whole street of customers at one time. So you can see how having to close the form and reopen it to update the list can be a bit of a pain.

I mean, the combo box works fine, there's nothing wrong with what i've done because like i said, it all works perfectly if the form is closed and reopened, so i just want it to refresh the combo box. I don't know why it doesn't work :confused:
 
Clearly I don't understand how this is set up. Does it lookup the same table as is the recordsource of the form?

Try using the forms on current event or the combos on got focus event?`

I think for someone to take a shot at this, one would need other details then what you have provided.

Recordsource of form, rowsource of combo, relationship between the two tables (if there are two tables), controlsource of the combo... such stuff. Perhaps strip down the db to the relevant parts, zip it and attach it to your post, so someone can have a look, this seems to become a guessing contest ;)
 
Thanks alot everyone!! Finally got there, putting the code in the forms OnCurrent event works perfectly!! Thanks Pat! Everything sorted, thanks to you all again. :D
 

Users who are viewing this thread

Back
Top Bottom