Restrict Specific Characters from Form

M

mcm52188

I have a simple database with a table containing product information. I also
have a form that is used to input new products. The table cannot contain
quotations, a plus sign, or returns in each field. Is there a way to restrict
these characters from being entered? If not, is there code to search the data
in the table to find the "+" or "" and delete them?
 
M

mcm52188

Thank you for this. I was able to get Not Like "*+*" to work.

But when I try to enter And Not Like "*["]*" And <>Chr(13) And <>Chr(10) it
gives me an error message, either text string too long or incorrect syntax.
I've tried entering these in by themselves as well as together. I am
entering these into the Validation Rule in the design View for the table.

KARL DEWEY said:
What about using field validation --
Not Like "*+*" And Not Like "*["]*" And <>Chr(13) And <>Chr(10)

mcm52188 said:
I have a simple database with a table containing product information. I also
have a form that is used to input new products. The table cannot contain
quotations, a plus sign, or returns in each field. Is there a way to restrict
these characters from being entered? If not, is there code to search the data
in the table to find the "+" or "" and delete them?
 
J

John W. Vinson

Thank you for this. I was able to get Not Like "*+*" to work.

But when I try to enter And Not Like "*["]*" And <>Chr(13) And <>Chr(10) it
gives me an error message, either text string too long or incorrect syntax.
I've tried entering these in by themselves as well as together. I am
entering these into the Validation Rule in the design View for the table.

KARL DEWEY said:
What about using field validation --
Not Like "*+*" And Not Like "*["]*" And <>Chr(13) And <>Chr(10)

mcm52188 said:
I have a simple database with a table containing product information. I also
have a form that is used to input new products. The table cannot contain
quotations, a plus sign, or returns in each field. Is there a way to restrict
these characters from being entered? If not, is there code to search the data
in the table to find the "+" or "" and delete them?

Actually the ["] syntax won't help - the quote is still being seen as
terminating the string. To find a doublequote inside a field you must use a
double doublequote:

LIKE "*""*"

Spacing it out, that's

LIKE "* " " *"
 
M

mcm52188

This worked! Thank You!!

John W. Vinson said:
Thank you for this. I was able to get Not Like "*+*" to work.

But when I try to enter And Not Like "*["]*" And <>Chr(13) And <>Chr(10) it
gives me an error message, either text string too long or incorrect syntax.
I've tried entering these in by themselves as well as together. I am
entering these into the Validation Rule in the design View for the table.

KARL DEWEY said:
What about using field validation --
Not Like "*+*" And Not Like "*["]*" And <>Chr(13) And <>Chr(10)

:

I have a simple database with a table containing product information. I also
have a form that is used to input new products. The table cannot contain
quotations, a plus sign, or returns in each field. Is there a way to restrict
these characters from being entered? If not, is there code to search the data
in the table to find the "+" or "" and delete them?

Actually the ["] syntax won't help - the quote is still being seen as
terminating the string. To find a doublequote inside a field you must use a
double doublequote:

LIKE "*""*"

Spacing it out, that's

LIKE "* " " *"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top