Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Home > Forums > Access Forum > Bad Word Trapping by Rex Buckingham
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Bad Word Trapping
Rex Buckingham 
     
17 hours ago
Hi!

How do I have MS Access check against a table that contains forbidden words entered there and tell the user that they cannot use that word in the field but otherwise allow the rest of the text in the field?

Thanks!

Rex
Donald Blackwell  @Reply  
        
16 hours ago
Rex Richard has a video Character Word Substitutions that shows using a table to clean up crazy words or characters in fields that might help.
Rex Buckingham OP  @Reply  
     
16 hours ago
Thank-you! This will work. Also found a way to do this a bit differently after posting.
I can send the code if interested but its kind of involved.

Rex
Donald Blackwell  @Reply  
        
16 hours ago
Yeah, there's lots of ways to do just about everything, from using code and holding strings of text, to using Arrays, or using tables and just a little search, filtering, and replace. Glad that's what you were looking for :)
Richard Rost  @Reply  
          
7 hours ago
Yeah, there are lots of ways to do it. That's the beautiful thing about Access: there are a million ways to do just about everything. That's why all I do is show you the different Lego pieces, and you can put them together however you want.

You could keep the forbidden words in a simple table and, whenever someone updates the field, loop through that table with a Recordset. Use the InStr function to see whether each forbidden word appears anywhere in the entered text. If you find one, cancel in BeforeUpdate and let the user know which word isn't allowed.

That's about the only method I recommend because it is easy to maintain. Add or remove words from the table without having to modify VBA code.
Add a Reply Upload an Image
Next Unseen

 
 
What's This?

 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 9/22/2026 4:18:07 PM. PLT: 1s