Not in list Event

mveijndh

Registered User.
Local time
Today, 02:48
Joined
Dec 17, 2011
Messages
113
I've just been looking over several fora to find my basic bearings on the Not in List event and the way to make it work. To be homest I have an issue, and I can't find the solution. Just the basics:
I have a form with two comboBox's, 1st for Company, 2nd for Client name.
I want to filter the second with a Like "* part of cmb B *" for the second and I think I can do that, but that's a later worry.
For each combobox I have the NotInList on Form A event set to open the form to add the new company data, starting with the basic data from Form A cmb B. After that I want to go back to the calling form and requery the combobox. just in details:
I have form A with combobox B, this calls Form X. After completing X, I have to close X, come back to form A, requery combo B, set focus to Combo B and dropdown.
What events on what object in what order do I have to set?
To give you a head start, I think I have to start on From A, cmb B, not in list event!
 
A afterupdate or A notinlist A afteteupdate;
Requery B;
B afterupdate or B notinlist By afterupdate;
 
Hi ,
Not quit clear, I run the not in list from B, not from A?
After returning from X I need to requery B. I presume X runs acDialog to prevent other things happening?
After getting back from form X, I try to requery B. This gives me an error 2218 save field value??
 
Last edited:
It may be more fruitful for you to post your code and high light the line giving you the error.
 
Hi,

that might be true but I want to get the basics of it what to do where and why. So far with reading all posts and literature it still is not clear to me. I'm working on a large project, but this is applicable to many situations. I'll set up a small database for the looks of it.
 
Hi
That's made a lot clear, meaning I can now get the requered data from the field. I've just to find out how to get the entered data in the combobox after requery without having to type that again.
Further more I need to get the subForm requery after the update form the Contact person. This has a one-one relation.
 
I've build a small database, to store VBA code snippets, nice way to practice the combobox.
Form the combo I can start the frmCodeBasAdd, with
Private Sub cboAccesCodeBas_NotInList(NewData As String, Response As Integer)
DoCmd.OpenForm "frmCodeBasAdd", acNormal, , , acFormAdd, acDialog, NewData
Me!cboAccesCodeBas.Requery
Me!frmAccessCode!cboAccesCodeBas.Value = NewData
End Sub

after adding a new item, I close the form with:

Private Sub Form_AfterInsert()
DoCmd.Close acForm, "frmCodeBasAdd", acSaveYes
End Sub

Getting back from the form I want to requery the combobox, but then I get an error 2118, I can only reqeury after saving the field.

how do I solve this??
 
Try
Code:
Private Sub cboAccesCodeBas_NotInList(NewData As String, Response As Integer)
    DoCmd.OpenForm "frmCodeBasAdd", acNormal, , , acFormAdd, acDialog, NewData
    Response = acDataErrAdded
End Sub
 

Users who are viewing this thread

Back
Top Bottom