Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text/Input Validation when Not in List 2

Status
Not open for further replies.

mulligh

Technical User
May 8, 2001
97
US
Several people helped me get my text validation for a text box ( but now I have a new problem!

I also want to use the same input validation *first*, before the string is checked against whether it's in the list. I put this code from the link above in the Before update event, but it appears that the "Not in List" event fires first. So then I tried to insert this code in the "Not in List" event procedure, but I get "Ambiguous name detected: ValidText".

Does anyone know what I am doing wrong? Thanks.
 
try the "NotInList" event... here's an example:


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

If msgbox("Data entered is not in list", vbOKOnly) = vbOK Then
Response = acDataErrContinue
End If

End Sub
 
I don't think I stated my problem very well. I have a combo box. I want to limit entries to those in the list. But, I want to make sure that when the entry is checked against the list, that it's in the correct format first. The correct format is a series of letters followed by a space followed by a series of numbers, e.g. Jones 1234 or NA 3333. Thanks for any help.
 
The Ambiguous name error means that you have the function ValidText() defined twice in your code. Move your code to the not in list event, but make sure you haven't duplicated the code in another event. Maq B-)
<insert witty signature here>
 
Thanks to you both! I now have it working correctly. I just renamed the function (gee, why didn't I think of that!) and I used wacks tip to get rid of that annoying error message.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top