Validation Rule Modification

  • Thread starter Thread starter yamefui
  • Start date Start date
Y

yamefui

Hello,

I have a current validation rule for a TEXT data type that is: Is Null Or
Like "??????" (so the user must enter 6 characters, which will always be
mixed between numerals and alpha characters).

How can I change this to have all of the alpha characters automatically
converted to upper case? I'm not sure where to use the '>' character to
execute this? Thank you kindly.
 
The input mask will not check for nulls. I would put a little bit of code in
the after update event to capitalise the letter and warn users if null or not
the right amount of digits.
 
Regrettably, I'm not knowledgeable about VBA code for MS Access yet. Can you
point me to a reference site that may assist me (one that may offer free bit
of code or code that can be manipulated)? Thank you.
 
You can reject any non-letter characters, and also convert each character as
its typed into a control on a form by putting the following in the KeyPress
procedure of the control:

Dim strCharacter As String

' determine if a letter
Select Case KeyAscii
Case 65 To 90 ' A-Z
' allow
Case 97 To 122 ' a-z
' allow
Case 8 ' backspace
Case Else
' reject
KeyAscii = 0
End Select

' Convert ANSI value to character string.
strCharacter = Chr(KeyAscii)
' Convert character to upper case, then to ANSI value.
KeyAscii = Asc(UCase(strCharacter))

This does of course mean that the data must be entered via the form, but
data should always be entered via forms in any case, never directly into a
table in raw datasheet view.

Ken Sheridan
Stafford, England
 
Oops. Misread the OP. thought it said 'all alpha characters', not 'all of
the alpha characters'. Add the following to the Case construct:

Case 45 To 57 ' 0-9

Ken Sheridan
Stafford, England

Wayne-I-M said:
You can reject any non-letter characters

???
 

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

Back
Top