Disallow word in a bound text box

  • Thread starter Thread starter Allison
  • Start date Start date
A

Allison

Access 2000, Win XP SP 2

I have a form for entering information on a vendor. It's bound to a query
against the vendor table.

In the fldVendorName field, I'd like to disallow any use of one particular
word (because that vendor is not allowed to do business with us).

What's the best way to do this? Is there some sort of check that can be
performed on exit of the field? Then if this word is there, pop up an error
message and erase the entry?

Open to suggestions for how to ensure this vendor doesn't get into the
database. Thank you.
 
Allison said:
Access 2000, Win XP SP 2

I have a form for entering information on a vendor. It's bound to a query
against the vendor table.

In the fldVendorName field, I'd like to disallow any use of one particular
word (because that vendor is not allowed to do business with us).

What's the best way to do this? Is there some sort of check that can be
performed on exit of the field? Then if this word is there, pop up an error
message and erase the entry?

Open to suggestions for how to ensure this vendor doesn't get into the
database.

Use the text box's BeforeUpdate event:

If Me.txtVendor Like "*theword*" Then
MsgBox "Vendor is not allowed"
Cancel = True
Me.txtVendor.Undo
End If
 
Back
Top