Change system message

S

Sarah at DaVita

When you have a combo box where you must choose something from a list and the
list to list property is set to Yes the message that comes up is "The text
you entered isn't an item in the list. Select an item from the list, or
enter text that matches one of the listed items" I would like to personalize
that message based on the control (this so I can change the message depending
on the control - different control different message). Is there a way to do
this? Thanks.
 
U

UpRider

Sarah, use something like this in the NotInList event for the combobox:

Private Sub Combo10_NotInList(NewData As String, Response As Integer)
MsgBox " You must enter valid data .", vbOKOnly, " G O O D D A T A
R E Q U I R E D "
Me.Undo
Response = acDataErrContinue
End Sub

UpRider
 
S

Sarah at DaVita

When I put this is the form ignors it and the other message still appears. I
put it on the control where the incorrect data can be entered.
??????
 
J

John W. Vinson

When I put this is the form ignors it and the other message still appears. I
put it on the control where the incorrect data can be entered.

Be sure the combo's Limit to List property is set to Yes.

John W. Vinson [MVP]
 
U

UpRider

Sarah:
Open the form in design view.
Press F4 to get the property sheet
Click on your combo box
On the property sheet, click the EVENT tab
In the line for 'on not in list', drop down and choose 'EVENT PROCEDURE'
Click on the ... (3 dots)
A code window will open with the cursor just were it needs to be.
The cursor will be between 2 lines of code.
Paste the below 3 lines there:

MsgBox "You must enter valid data ."
Me.Undo
Response = acDataErrContinue

Close the code window, go to form view and try it.

UpRider
 
Top