Global ValidationRule Properties

  • Thread starter Thread starter Charles L. Phillips
  • Start date Start date
C

Charles L. Phillips

Hello,
Is there a way to apply a "ValidationRule" property globally?

Example:
I have five (5) tables, each having a "telephone number" field.
Is there a way to set the "ValidationRule" property once (globally) for ALL 5 tables???


Charles L. Phillips
 
Not really. What you can do is build a function that runs on the before
update event of a form to validate the phone number. Here's one that I use:

Public Function FormatPhone(strIn As String) As Variant
' Arvin Meyer 10/23/1998
' Last Updated 1/15/2003

Select Case Len(strIn & vbNullString)
Case 0
FormatPhone = Null
Case 7
FormatPhone = Format(strIn, "@@@-@@@@")
Case 10
FormatPhone = Format(strIn, "(@@@) @@@-@@@@")
Case 11
FormatPhone = Format(strIn, "@ (@@@) @@@-@@@@")
Case Else
FormatPhone = strIn
End Select

End Function

In the BeforeUpdate event of the form I just use something like:

Call FormatPhone(Me.txtPhone)
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access

Hello,
Is there a way to apply a "ValidationRule" property globally?

Example:
I have five (5) tables, each having a "telephone number" field.
Is there a way to set the "ValidationRule" property once (globally) for
ALL 5 tables???


Charles L. Phillips
 
Hello,
Is there a way to apply a "ValidationRule" property globally?

Not that I know of. You can copy and paste it from one field to
another, and it's a one-time operation.

What's with the .gif file attachment??
 
Back
Top