Jan 25 2006, 02:53 AM
I would greatly appreciate it if someone could please help me. I need to update the Combobox instantly.
Problem: ComboBox on a form is linked to table, the form has a button which brings up the form to add new options in combobox dropdown list. After adding a new item, it does not show unless I close form and open it again. Is there a way to show info instantly without having to close?
I just read this exact situation in the recent post "Updating rows in a Combobox", but the answers given do not help me. I am new and maybe I just don't understand.
In HiTechCoach response on the previous response: "I prefer to use on On Enter event. Even better is to have the Form used to add the item, look to see if the form is loaded and then tell the combo box to requery. This way it only requires as needed."
How do you go about setting the On Enter event? and how do you have the Form used to add the item, how do you tell the combobox to requery? I am so sorry to sound so dumb!!!
Can someone please explain this fix in a little more detail. I don't even know what I'm trying to build in the On Enter event. (ie an expression, code or macro) or how to build it. Sorry again. This is probablly so simple for you.
Thanks so much for your help.
Jan 25 2006, 03:20 AM
Welcome to Utter Access!
To add the Me.Requery to the On Enter Event of the combo box:
Next to the On Enter event select event procedure.
Then to the right of the event procedure text click the button labeled "..."
In the VBA editor window that appears type this:
before the End SUB. Where YourControlName will be the name of your combo box.
It will look like this if the combo box has the name ComboLastName:
Private Sub ComboLastName_Enter()
Close the VBA editor window. Save the form.
That is all.
Hope this helps...
Edited by: HiTechCoach on Wed Jan 25 3:29:15 EST 2006.
Jan 25 2006, 03:45 AM
You are absolutely awesome.
I have two buttons to fix with this. It worked like a charm on one, but the other has another problem:
When I add a new item on main form, it asks me if I want to add it, I click Yes, then the new form pops up and I add it, but when I try to close that form to go back to the main form it says: "Run-time error 2001. You cancelled the previous operation." If I then choose End it tells me the item is not in the list, if I choose Debug, it takes me to visual basic with this line highlighted: DLookup("Measurement/etc", "Measurement/etc (Recipe Ingredients Table)", "[Measurement/etc]='" & NewData & "'")
Is something wrong with this line?
Hope this makes since. Thank you so much for your help!!!
Jan 25 2006, 03:50 AM
Just noticed your Tables and Fields seem to have a special character.
Check Reserved Words
Jan 25 2006, 12:28 PM
As Jay pointed out, you should avoid special characters in object and field names. If you do then you must use [ ] to wrap around the name so that Access does not get confused and will know where a names starts and ends.
DLookup("[Measurement/etc]", "[Measurement/etc (Recipe Ingredients Table)]", "[Measurement/etc]='" & NewData & "'")
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here