Code for text that doesn't match that required

D

dbl

Hi I am stuck with the following, how do I get my code to give the message
in the MsgBox if the data in field CarComercial is null or has any value
other than Private Car or Commercial Veh/Van

If (Me.Insurer) = "AAC" Or (Me.CarCommercial) = "Private Car" Or
(Me.CarCommercial) = "Commercial Veh/Van" Then

GoTo SkipMe
Else

If (Me.CarCommercial) = !!! Help needed here !!! Any text other than above
or null !!!! Then
MsgBox "You Cannot Proceed Without Entering Private Car or Commercial
Veh/Van"
Me.InvoiceVatTo = "Error Insufficient Data You Must Not Proceed"


Exit Sub

SkipMe:

Thanks Bob
 
J

John Vinson

Hi I am stuck with the following, how do I get my code to give the message
in the MsgBox if the data in field CarComercial is null or has any value
other than Private Car or Commercial Veh/Van

Rather than making the user type in all this text and punishing them
if they make an error, why not simply use a Combo Box with a List of
Values row source containing these two options?

John W. Vinson[MVP]
 
D

dbl

John that's a case of not being able to see the wood for the trees.
The combo box has sorted the problem.

Thanks for your help.
Bob
 
D

dbl

John it hasn't completely sorted the problem the text is imported to the db
monthly (updates) they are not always in the right format i.e. the wording
is not always the same. How do I stop code running if the words are
different from that required i.e. Private Car or Commercial Veh/Van. The
combo stops us from changing the text to any other than that required, but
the code still runs if Car was imported.

Thanks Bob
 
Top