Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

validation rules and input

Forum home » Delegate support and help forum » Microsoft Access Training and help » Validation rules and input masks

Validation rules and input masks

ResolvedVersion 2003

Amie has attended:
Access Introduction course
Access Intermediate course
Access Advanced course

Validation rules and input masks

Hi I want to make sure when people are entering the postcode into a field its done in the correct format
i.e SW1Y 4JU or SW6 5TD so capitals are forcibly used.
I tried inputting the expression >L which would at least force only capitals to be enetered??But this didnt work
please can you give the correct expression.

Many Thanks

Amie

RE: Validation rules and input masks

Hi Amie,

According to http://bytes.com/forum/thread210163.html you can use UCase() in the *AfterUpdate* event of the text box to convert the case.

In terms of displaying uppercase to the user, you can place a > in the format event of the text box (but not for memo fields).

Also: "It is also possible to use the KeyPress event to alter the KeyAscii to the upper case version of the entry. You still need the AfterUpdate event as well, in case the user pastes text in."

I hope this answers your question.

Sorry for the delay in answering, we have a lot of questions at the moment.

Also, I hope you enjoyed the Access Introduction course.

Regards, Rich

RE: Validation rules and input masks

Hi Rich sorry I do not understand the terms you have used."It is also possible to use the KeyPress event to alter the KeyAscii to the upper case version of the entry. You still need the AfterUpdate event as well, in case the user pastes text in."
In laymans turns where do I enter the formula?
What do I enter?Will this set the rule forcing the Postal codes to be in Caps?

Thanks

RE: Validation rules and input masks

Hi Amie,

Looking into this a bit more, my previous answer is a bit complicated, when the solution can be obtained by using an input mask.

- Go to the Design View of your table.
- Click the DataType column of the field you want to edit (ie. Postcode).
- Underneath, where the properties are (General tab), click your mouse in the InputMask field. Then click the ... button to the right of this. This brings up the InputMask Wizard.
- Select 'postal code' from the list, then 'Next'

You'll notice the InputMask will be >LL00 0LL.
The > means everything will be uppercase. The L means a mandatory alpha character and the 0 means a mandatory numeric character. I found this was a problem, because some postcodes only have 1 number (eg. SP5 8DU). So I changed the InputMask to be >LL0# 0LL, where # is an optional numeric character.

Then choose your placeholder character - what your users will be overwriting. Eg. _ will show ____ ___

Then click 'next' and choose if you want the data to be stored with the space in between, or not.

Then click Finish.

Then switch to View mode (saving the table in the process) and try entering some data. You should be forced to input the correct alpha or numeric characters, and it will appear as uppercase.

So if you just wanted all Uppercase, you would make an InputMask to be > on it's own.

Note: you may have noticed that when a user is inputting data, they can still enter lowercase letters, and when they move away from the field it changes everything to uppercase. To have the field showing uppercase when entering the data, put a > in the 'format' box just above InputMask in Design View.

I hope this helps?

Regards, Rich

Attached files...

input-mask-access.gif

RE: Validation rules and input masks

Perfect thanks!!!

Access tip:

Duplicating an Entry

To duplicate the entry press CTRL+' (apostrophe)this will copy the contents of the previous entry in the same field.
(Table view, line above) note this also works in Excel.

View all Access hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.