Not In List

ddrew

seasoned user
Local time
Today, 19:43
Joined
Jan 26, 2003
Messages
911
I have a really simple (I hope) question, which I'm sure ive done before. But I cant remember. I have a ComboBox as limit to list. I now want the user to be able to add to the list.

So I know its a On Not In List event

I have searched but am unable to find a simple soloution.
 
In properties set Limit to List to "No"
 
Sorry I didnt explain well. I want an event to say "The item is not in the list do you want to add it?"
 
Hey DDrew,

Here's an example of code to add a value to a single field in a table. Hopefully this will get you jump started to know what to do from here.
It does go in the NotInList Event of the cboBox.

Dim db As dao.Database, rs As dao.Recordset

If Eval("Msgbox('The Type Of Doctor, ''" & NewData & "'' , Is Not On AMC''s List!@Would you like to add " & _
"Type Of Doctor, ''" & NewData & "'' , to AMC''s list?" & _
"@@',4,'Amigo Message System')") = vbNo Then
Me.TypeOfDoctorID.Undo
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("Doctor Type Of", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!TypeOfDoctor = NewData
rs.Update
rs.Close
Set rs = Nothing
Set db = Nothing

If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If

HTH,
Shane
 

Users who are viewing this thread

Back
Top Bottom