after Not in List Event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:

I have a "Not in List Event" in a form, Form A, that adds data to my
"look-up" table. After this data is added, I want to open another form, Form
B, but only if a "Not in List Event" occurs.

In other words, "How do I open a form in, perhaps, an 'After update event'
with the condition that a "Not in list event" has previously occured?

I ask because I want to use the new value in "Form A" as a reference to
"Form B".

I appreciate any help!

-Gabriel M.
 
After you add the new value to the lookup table in FormB, you need to
requery the combo on FormA so it gets to hear about the new entry. You
cannot requery it while its NotInList event is executing. Therefore you
cannot use the NotInList event to add a new record in that way.

Instead, use another event - perhaps the combo's DblClick event, or perhaps
a custom shortcut menu (when you right-click the combo, which is what Access
2007 now does without any code.) Alternatively, place a command button
beside the combo, and use its Click event.

Then in the AfterUpdate event procedure of FormB (i.e. the form's event, not
that of a control), requery the combo on the other form. This kind of thing:

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("FormA").IsLoaded Then
Forms("FormA")![MyCombo].Requery
End If
End Sub
 
Thanks Allen,

So there is no way of performing an action using the condition that a
"not in list" event has occured, right?

Allen Browne said:
After you add the new value to the lookup table in FormB, you need to
requery the combo on FormA so it gets to hear about the new entry. You
cannot requery it while its NotInList event is executing. Therefore you
cannot use the NotInList event to add a new record in that way.

Instead, use another event - perhaps the combo's DblClick event, or perhaps
a custom shortcut menu (when you right-click the combo, which is what Access
2007 now does without any code.) Alternatively, place a command button
beside the combo, and use its Click event.

Then in the AfterUpdate event procedure of FormB (i.e. the form's event, not
that of a control), requery the combo on the other form. This kind of thing:

Private Sub Form_AfterUpdate()
If CurrentProject.AllForms("FormA").IsLoaded Then
Forms("FormA")![MyCombo].Requery
End If
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Mercadogs said:
Hello:

I have a "Not in List Event" in a form, Form A, that adds data to my
"look-up" table. After this data is added, I want to open another form,
Form
B, but only if a "Not in List Event" occurs.

In other words, "How do I open a form in, perhaps, an 'After update event'
with the condition that a "Not in list event" has previously occured?

I ask because I want to use the new value in "Form A" as a reference to
"Form B".

I appreciate any help!

-Gabriel M.
 
Back
Top