Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: Problem with requerying a combo box

Geek News

Problem with requerying a combo box
SHIPP 12/17/2008 2:52:20 PM
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.
--
M. Shipp
RE: Problem with requerying a combo box
RonaldoOneNil 12/17/2008 3:34:34 PM
Use this instead
If CurrentProject.AllForms("frmWorkOrder").IsLoaded = True Then
Forms!frmWorkOrder.cboAssignID.Requery
End if

"SHIPP" wrote:

[Quoted Text]
> 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.
> --
> M. Shipp
RE: Problem with requerying a combo box
Beetle 12/17/2008 3:38:01 PM
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.
--
_________

Sean Bailey


"SHIPP" wrote:

[Quoted Text]
> 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.
> --
> M. Shipp

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net