Problem with requerying a combo box

S

SHIPP

I have a form where I am using the double click event of a combo box to open
up another form so that I can add additional records for the combo box. On
the close event of this second form I have the following code:

If Forms!frmWorkOrder.IsLoaded = True Then
Forms!frmWorkOrder.cboAssignID.Requery
End If

The desired result is to requery the combo box on my primary form so that I
can now see the added record. The error I get is Erro 2465
Application-defined or object-defined error.

In addition if I simply open up the secondary form to add a record without
the primary form being open I get Error 2450 can't find frmWorkOrder.

I have tried to put the code in the close event as well as the unload event.
The errors occur either way. Any help would be appreciated.
 
R

RonaldoOneNil

Use this instead
If CurrentProject.AllForms("frmWorkOrder").IsLoaded = True Then
Forms!frmWorkOrder.cboAssignID.Requery
End if
 
B

Beetle

To check if the form is loaded;

If CurrentProject.AllForms("frmWorkOrder").IsLoaded = True Then
'do whatever
End If

Curious why you're not using the combo box Not In List event to handle
this. You can have it open your other form in Dialog mode (which will
halt the code), then when the other form is closed, the code will continue
and will requery the combo box.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top