unique input mask

G

garret

Hello. I am trying to create an input mask for a field which will
always look like this:

Letter-#####

except the letter will always be either A, B, C, or D. I know how to
limit it to a letter but not to only these letters.
Thanks.
 
F

fredg

Hello. I am trying to create an input mask for a field which will
always look like this:

Letter-#####

except the letter will always be either A, B, C, or D. I know how to
limit it to a letter but not to only these letters.
Thanks.

Set the Validation Rule for this control to:
Left([ControlName],1) In ("A","B","C","D")

Also set a user friendly Validation Text message.
 
G

garret

Wondering...can you explain what this code does?

Also, it doesn't work for me. What is the ControlName? This is in the
creation of a new field in a table..not a text box in a form.
 
F

fredg

Wondering...can you explain what this code does?

Also, it doesn't work for me. What is the ControlName? This is in the
creation of a new field in a table..not a text box in a form.

Please always include the relevant portion of any previous post when
asking a question. Someone reading this last post will have no idea of
what you are talking about.

1) You should place the
Left([ControlName],1) In ("A","B","C","D")
directly in the Table field's Validation Rule property.
Since no one knows (except you) what the real name of the field is,
[ControlName] is generic and should be replaced by you with the actual
name of the field.

2) You should not be doing any data entry directly into a table.
Always use a Form.
 
G

garret

Hey Fred, sorry..

I tried entering
Left([ControlName],1) In ("A","B","C","D")
substituting the "ControlName" with the field name (DrawingNo). This
however gave me several error messages, so I am still confused.

I know I would be entering data on the form, but I didn't want to make
the validation property part of the text box (as I thought you thought
I was trying to do), I wanted it to be a property of the field.
 
F

fredg

Hey Fred, sorry..

I tried entering
Left([ControlName],1) In ("A","B","C","D")
substituting the "ControlName" with the field name (DrawingNo). This
however gave me several error messages, so I am still confused.

I know I would be entering data on the form, but I didn't want to make
the validation property part of the text box (as I thought you thought
I was trying to do), I wanted it to be a property of the field.

Shall I guess what the error numbers/messages are?
Probably that you can't enter a letter in a field that is designated
as Number datatype.

If DrawingNo is a Number datatype, you can NOT enter any letter in the
field, period!
If the DrawingNo is Text datatype, then perhaps you can let us know
what the error messages are.
I assume your dataentry is something like "A2345", "C9876", etc.
If you place
Left([DrawingNo],1) In ("A","B","C","D")
in the field Validation rule property, it should work (if the field is
Text datatype). It works for me.

Use a form for data entry, always. After you add the validation rule
to the table field, add the field to the form, using the field List
tool button.
 
G

garret

After Inserting that code into the Validation rule property, I get the
error message

There was an error compiling this function.
The Visual Basic module contains a syntax error.
Check the code, and then recompile it.

Does this have something to do with any properties in Visual Basic that
may have been changed?
 
G

garret

Nevermind, it had something to do with my previous data and my
unfinished module, but I cleaned it up and it works correctly now.
Much thanks for you and your patience =).
 
Top