Requery simply won't do, please help.

wjoc1

Registered User.
Local time
Today, 04:18
Joined
Jul 25, 2002
Messages
117
Hi, this is kind of a long problem but I'll explain it as best I can. I have two forms, Add a New Record and Add a New Code. Add a New Record has a combo box control and it gets it values from a query which gets its information from a Codes table. This all works fine, as it should.

Now on the Add a New Record form I have a button which lets the user add a new code while in the middle of entering a record. It opens the Add a New Code form whcih is based directly on the Codes table and the user can add a new code.This also works fine.

Now when the user closes the Add a New Code form they return to the Add a New Record form. However the code that was just added to the Codes table doesn't show up in the drop down list of the Combobox. I have tried putting the following into the onClick event of the combobox:

Me![name_of_control_].Requery

But this doesn't work, it doesn't seem to rerun the underlying query at all.

I have to exit out of the record, i.e. the Add a New Record form and then re-open this. For those of you who are following these ramblings I also put the following into the AfterInsert event of the Add a New Code form just to make sure all the new contents were saved explicitly before I returned to the Add a New Record form and requeried the combobox:

DoCmd.RunCommand acCmdSaveRecord

What am I doing wrong, can someone plese please help me.
If I am not explaining this thoroughly enough then I'll post some code up in case this should work and I'm making some other stupid mistake/mistakes!

Thanks,

Liam
 
This is just a thought, since I haven´t done anything like it.

Shouldn´t you specify the query to requery, rather than specifying the control that has the query as its source? Am I wrong here?

Also, have you tried me.refresh?

Fuga.
 
YOu have got to use the requery but if you are leaving the form can you not do an on activate event of the form and do

me.controlname.requery

that should do it I think...
 

Users who are viewing this thread

Back
Top Bottom