Lookup list refresh problem

usr33t

Registered User.
Local time
Today, 19:20
Joined
Dec 1, 2004
Messages
21
Hi,

I have a form, used in a medical database, which contains the lookup field DOCTOR, which updates depending on the contents of a table called DOCTORINFO.

Next to this field I have a command button which, when pressed, opens the DOCTORINFO form, allowing the user to enter the name details of a new DOCTOR (the original form is still open in the background).

Once this information has been completed a command button on the DOCTORINFO form is pressed, which through the use of DoCmd.Save and DoCmd.Close statements saves the new doctor information and closes the form, returning the user to the original form.

When I go to select the doctors name from the DOCTOR lookup field on the original form, the data I have just entered is not present. However, if I close the form and then open it, the data is now present in the list.

How do I get the lookup list to update without having to close and reopen the original form?

If anyone can help that would be great.

Best regards
Russell
Usr33t
 
You have to requery the control that shows the Doctors to refresh the data from the query.
 
Thanks for that. I kind of understand what you mean but how exactly would I do this (i.e. what code etc would I use, and where would I put it)?

Thanks again. Your help is very much appreciated.

Cheers
Russell
(Usr33t)
 
Any Updates on Updates?

I'm in a similar boat. Any inputs on how to force a requery in an open form when a subform or something is closed. I got into macros, and couldn't find anything appropriate. I have a similar routine to add a new person to a list by opening a form with the NotOnList event option, but I can't put it all together smoothly and have the name open on the original form without open/close of orig form or hitting the refresh button up in the toolbar....

Any Thoughts?
 
Squid11 said:
I'm in a similar boat. Any inputs on how to force a requery in an open form when a subform or something is closed. I got into macros, and couldn't find anything appropriate. I have a similar routine to add a new person to a list by opening a form with the NotOnList event option, but I can't put it all together smoothly and have the name open on the original form without open/close of orig form or hitting the refresh button up in the toolbar....

Any Thoughts?
mylistbox.requery or
mycombo.requery
to requery the current form use
me.requery

Put the requery right after the code that opens the form

Docmd.open form "Myform"
mylist.requery

This will open your form where the user can do his thing. After he does his thing and closes the form the next line of code (mylist.requery) will be executed and the listbox will be updated
 
Last edited:
Thanks Gem. I actually did a little homework on the site and ran a search on the notinlist theme and got a big education, but I like your idea best. I'll give it a run, thanks.
 

Users who are viewing this thread

Back
Top Bottom