docmd.setwarnings code problems

SteveC24

Registered User.
Local time
Today, 21:04
Joined
Feb 1, 2003
Messages
444
Hello

Could someone please tell me what is wrong with my code?
Code:
Private Sub lengthmeasureselect_NotInList(NewData As String, Response As Integer)
DoCmd.SetWarnings False
If MsgBox("Please select a value from the list.", vbOKOnly + vbInformation, "Value Not Found in the List") = vbOK Then
Exit Sub
Else
Exit Sub
End If
DoCmd.SetWarnings True
End Sub
Basically, if the user enters a value into a combo box which isn't in the list, I would like a message to pop up saying to select a value from the list.

I want to disable the default Access message about it...I thought I could do that with the docmd.setwarnings code?

Thanks for any help!
 
Hi

You need to set the response to

response = acDataErrContinue this should suppress the access message


Private Sub lengthmeasureselect_NotInList(NewData As String, Response As Integer)

MsgBox "Please select a value from the list.", vbOKOnly + vbInformation, "Value Not Found in the List"

response = acDataErrContinue


End Sub


Chris
 
I do belive there are builtin functions (ie in the combo box) that provides exactly what you are looking for?
 
OK, that is grand, I now have that working.

Could you possibly post the most common "bits" that come after Response = ?

The one I am on at the moment is to get rid of the delete confirmation message...but may need others in the future!

Thanks!
 

Users who are viewing this thread

Back
Top Bottom