Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NotInList question 1

Status
Not open for further replies.

ajking

Technical User
Aug 13, 2002
229
I have a combobox which, if the name entered is not in the list, allows a name to be input. That works fine but what I would like is, instead of the NotInList event running the existing VBA code I would like it to open a subform "DetailEdit" which I have already created for editing the personnel table. Any suggestions would be much appreciated. TIA



'Life is what happens to you while you are busy making other plans' John W. Lennon 1940-1980
 
IF you look at this thread, at the very bottom I posted the code to do what it is I believe you are looking for:

thread700-662265

vree

"For a succesful technology, reality must take precedence over public
relations, for nature will not be fooled."
R.Feynman
 
Hi

In the NotInList event of the combo box I have:

If MsgBox("Not in the List of Valid Warehouses, do you wish to add it?", _
vbYesNo, "Warning") = vbYes Then
DoCmd.OpenForm "frmWarehouses", acNormal, , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
Else
End If

The Combo box is set to limit to list = True, and the first column (ie the key column) is NOT hidden

In the called form (frmWarehouses) on open event I have:

Private Sub Form_Open(Cancel As Integer)
If IsNull(Me.OpenArgs) Then
Else
cmdNew_Click
strWarehouse = Left(Me.OpenArgs, 2)
End If
End Sub

and that works for me


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks for replying. I have tried both methods
method 1 (vree)is nearly there but it deals with one field only and the data entry form I want to call has four fields.
method 2 (kenreay)there is an error; cmdnew_click (missing function)also I would like to pass the data that was typed into the [main form] name field (Newdata) to the name field in the subform. also the notinlist warning box pops up after you exit the subform. any way to supress this?

'Life is what happens to you while you are busy making other plans' John W. Lennon 1940-1980
 
Hi

The code I posted is an example, it works with a seperate modal form which is displayed if the user responds with yes to the do you want to add data message. It DOES pass the typed data via the OpenArgs method, and the code shown for the on open event of the modal form. The cmdNew_Click is standard wizard created Add new row code, I did not really see the point in posting it

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Many thanks Ken, it works fine now

'Life is what happens to you while you are busy making other plans' John W. Lennon 1940-1980
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top