R
Rondy
(Sorry if dup, window went blank when I hit Post!)
Working in A2K with linked SQL tables -- I know, it's antiquated, and we
WILL be updating SOON! but in the meantime if anyone can recall back that
far...
I have a validation rule that can be applied to the same field on various
forms, so I need to make it re-useable and have code in one spot for easy
admin. The rule is conditional based on data from switchboard, so putting
code in the form's Open Event, like so:
Private Sub Form_Open(Cancel As Integer)
If Forms!frmSwitchboard!Site.ListCount < 2 Then
strSiteRef.ValidationRule = "Like '*area*' or '*bldg*' or '*building*' or
'*phase*' or '*room*' or '*site*'"
strSiteRef.ValidationText = "Please reference an Area, Phase, Building,
Room, etc. for single-site jobs."
End If
End Sub
.... works like a charm! Problem is the Like list may need updating, so I
would prefer to have this in one place for admin and then refer to it on the
15 forms that can use it (rather than having to update 15 forms each time the
list changes).
I tried creating a macro and setting it to field's BeforeUpdate (If
Forms!frmSwitchboard!Site.ListCount < 2 Then strSiteRef.BeforeUpdate =
"SiteVal" [macro name]), but it still gives validate error even when field
contains one of the appropriate words.
Is there a better way to do this? Maybe create a Public Function, or have
the valid values in a table?
Thanks in advance for any help
Working in A2K with linked SQL tables -- I know, it's antiquated, and we
WILL be updating SOON! but in the meantime if anyone can recall back that
far...
I have a validation rule that can be applied to the same field on various
forms, so I need to make it re-useable and have code in one spot for easy
admin. The rule is conditional based on data from switchboard, so putting
code in the form's Open Event, like so:
Private Sub Form_Open(Cancel As Integer)
If Forms!frmSwitchboard!Site.ListCount < 2 Then
strSiteRef.ValidationRule = "Like '*area*' or '*bldg*' or '*building*' or
'*phase*' or '*room*' or '*site*'"
strSiteRef.ValidationText = "Please reference an Area, Phase, Building,
Room, etc. for single-site jobs."
End If
End Sub
.... works like a charm! Problem is the Like list may need updating, so I
would prefer to have this in one place for admin and then refer to it on the
15 forms that can use it (rather than having to update 15 forms each time the
list changes).
I tried creating a macro and setting it to field's BeforeUpdate (If
Forms!frmSwitchboard!Site.ListCount < 2 Then strSiteRef.BeforeUpdate =
"SiteVal" [macro name]), but it still gives validate error even when field
contains one of the appropriate words.
Is there a better way to do this? Maybe create a Public Function, or have
the valid values in a table?
Thanks in advance for any help