I know how to add a value to the value list for a NotInList event, but can I do this without having a message box popup to confirm? I would much rather have it be added without the user having to say OK.
I can't figure out which, if any, lines I can take out to get this. Here is my code:
Private Sub RcptNum_NotInList(NewData As String, Response As Integer)
Dim vResponse As Integer
vResponse = MsgBox("Data entered '" & NewData & "' is not contained in current list." & Chr(13) & "Do you wish to add it to the file?", 36, "New Data Prompt"
If vResponse = 6 Then
Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("purchase receipts", dbOpenDynaset)
MyRS.AddNew
MyRS("rcptnum"
= NewData 'put any and all field data expressions here. . .
MyRS.Update
MyRS.Close
MyDB.Close
Response = DATA_ERRADDED
Else
Me![FindCustomer] = Null
Response = DATA_ERRCONTINUE
End If
End Sub
Thanks!
I can't figure out which, if any, lines I can take out to get this. Here is my code:
Private Sub RcptNum_NotInList(NewData As String, Response As Integer)
Dim vResponse As Integer
vResponse = MsgBox("Data entered '" & NewData & "' is not contained in current list." & Chr(13) & "Do you wish to add it to the file?", 36, "New Data Prompt"
If vResponse = 6 Then
Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("purchase receipts", dbOpenDynaset)
MyRS.AddNew
MyRS("rcptnum"
MyRS.Update
MyRS.Close
MyDB.Close
Response = DATA_ERRADDED
Else
Me![FindCustomer] = Null
Response = DATA_ERRCONTINUE
End If
End Sub
Thanks!