Validation rule syntax

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 3 fields: pay plan, pay grade, pay step.
The number of steps in each plan/grade is stored in tblJunctionPlanGrade.JunctStepMax.
my attempted Validation Rule has an error
<=DLookUp("tblJunctionPlanGrade.JunctStepMax","tblJunctionPlanGrade.pplanID = Forms!cboPayPlan" And "tblJunctionPlanGrade.pgradeID = Forms!cbopaygrade"

I'd like the Validation Text to tell the user what maximum he exceeded. I'm pretty sure this syntax won't work
This pay plan and grade has only DLookUp("tblJunctionPlanGrade.JunctStepMax","tblJunctionPlanGrade.pplanID = Forms!cboPayPlan" And "tblJunctionPlanGrade.pgradeID = Forms!cbopaygrade") step

I'd appreciate a syntax fix, as this is my first attempt at validation rules.
 
The DLookup should be

<=DLookUp("tblJunctionPlanGrade.JunctStepMax","tblJunctionPlanGrade.pplanID
= " & Forms!cboPayPlan & " And tblJunctionPlanGrade.pgradeID = " &
Forms!cbopaygrade")

but if this is a validation rule for a table field, you can't use a DLookup.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Desert Bear said:
I have 3 fields: pay plan, pay grade, pay step.
The number of steps in each plan/grade is stored in tblJunctionPlanGrade.JunctStepMax.
my attempted Validation Rule has an error:
<=DLookUp("tblJunctionPlanGrade.JunctStepMax","tblJunctionPlanGrade.pplanID
= Forms!cboPayPlan" And "tblJunctionPlanGrade.pgradeID = Forms!cbopaygrade")
I'd like the Validation Text to tell the user what maximum he exceeded.
I'm pretty sure this syntax won't work:
This pay plan and grade has only
DLookUp("tblJunctionPlanGrade.JunctStepMax","tblJunctionPlanGrade.pplanID =
Forms!cboPayPlan" And "tblJunctionPlanGrade.pgradeID = Forms!cbopaygrade")
steps
I'd appreciate a syntax fix, as this is my first attempt at validation
rules.
 
Back
Top