Exclude a character (Apostrophe) in an input field of a form (1 Viewer)

Rich77

New member
Local time
Today, 08:34
Joined
Dec 26, 2023
Messages
9
In a form, an apostrophe may not be used in an input field (all other characters do not cause a problem). There are 2 options to solve this:
1. If the apostrophe is used, it will automatically be replaced by an underscore (with action "Replace").
2. If the apostrophe is used, a messagebox will warn you: "Apostrophe is not allowed" and you must first use another character.
I can't quite manage to implement either of these options without using a lot of VBA code.
Can anyone help me to solve this easily?
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:34
Joined
Sep 21, 2011
Messages
14,299
Answered in your duplicate post.
 

Isaac

Lifelong Learner
Local time
Yesterday, 23:34
Joined
Mar 14, 2017
Messages
8,777
check for the instr() of the char() or chr() value
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:34
Joined
Feb 19, 2002
Messages
43,275
Many surnames include the apostrophe in certain languages. This isn't a problem if you enclose search strings in double quotes. However, if your string might include double quotes, then you need to use the single. If the string can contain either, then there are techniques posted here for that also.
 

Users who are viewing this thread

Top Bottom