Disable system Messages

clauses

Registered User.
Local time
Today, 20:01
Joined
Feb 9, 2001
Messages
56
I have included a not in list event associated with a combo box on my form and have included a message as part of the event. When ever my message is dispalyed and answered the system message box appears telling the user that the item they entered is not on the list. Is there a way I can turn off the system message so that the user is not forced to respond to two messages that are very similar.
 
Add this function to your db:

Code:
Public Function Add2Source(tbl As String, fld2update As String, NewData As String) As Integer
'Adds record to the list if not already present
'This only works if there is just one field to update....

Dim StrMessage As String
Dim Dbs As Database
Dim RstTypes As Recordset
Dim Response As Integer
StrMessage = "'" & NewData & "' is not in current list" & _
" To add the item for future reference choose yes, or choose no to select from the present options."
Response = MsgBox(StrMessage, vbYesNo, "Not in List")
If Response = vbYes Then
Set Dbs = CurrentDb()
Set RstTypes = Dbs.OpenRecordset(tbl)
RstTypes.AddNew
RstTypes.Fields(fld2update) = NewData
RstTypes.Update
Add2Source = acDataErrAdded
Else
Add2Source = acDataErrDisplay
End If
End Function

Then call the function in the NotInList event as follows:

Response = Add2Source("TableName","FieldName",NewData)

HTH
 

Users who are viewing this thread

Back
Top Bottom