G
Guest
I am attempting to create a way, in access 03, to store simple if statements
in a table which are rules for various results. I want to be able to pull the
text of the statement to use in a visual basic statement to produce the final
value in a report.
The current table has the below fields
GoalName : GradeReq : Grade Rule
the GoalName (Name of the Goal for the person) and GradeReq (the postion the
goal applies for) are used with a dlookup statement in the visual basic code
to pull the correct goalrule.
Here is an example of the Goal rule:
IIf(cersRST <= 1 And cersRST > 0.9, 5, IIf(cersRST > 0.899 And cersRST <
0.85, 4, IIf(cersRST > 0.849 And cersRST < 0.8, 3, IIf(cersRST > 0.799 And
cersRST < 0.75, 2, IIf(cersRST < 0.749, 1, "Error")))))
Here is a snippit of the code I am using to get the results
Private Sub Report_Activate()
Dim cersRST As Integer
Dim cersGoalRule As String
On Error GoTo Err_Report_Activate
cersRST = Me.Report1subreport.Report.[Result3_Value]
'cersRST is the result from the associate used in the
'iff statement determine the final result
cersGoalRule = DLookup("[graderule]", "GradeRules", "[GoalName]= " &
"'" & Me.[GoalName] & "'" & " And [GradeReq] = " & "'" & Me.[GradeReq1] & "'")
Me.Rule = cersGoalRule
Exit_Report_Activate:
Exit Sub
Err_Report_Activate:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Report_Activate
End Sub
What I am hopeing to avoid is to be able to change goals for our associates
in the table and not have to reprogram the report.
in a table which are rules for various results. I want to be able to pull the
text of the statement to use in a visual basic statement to produce the final
value in a report.
The current table has the below fields
GoalName : GradeReq : Grade Rule
the GoalName (Name of the Goal for the person) and GradeReq (the postion the
goal applies for) are used with a dlookup statement in the visual basic code
to pull the correct goalrule.
Here is an example of the Goal rule:
IIf(cersRST <= 1 And cersRST > 0.9, 5, IIf(cersRST > 0.899 And cersRST <
0.85, 4, IIf(cersRST > 0.849 And cersRST < 0.8, 3, IIf(cersRST > 0.799 And
cersRST < 0.75, 2, IIf(cersRST < 0.749, 1, "Error")))))
Here is a snippit of the code I am using to get the results
Private Sub Report_Activate()
Dim cersRST As Integer
Dim cersGoalRule As String
On Error GoTo Err_Report_Activate
cersRST = Me.Report1subreport.Report.[Result3_Value]
'cersRST is the result from the associate used in the
'iff statement determine the final result
cersGoalRule = DLookup("[graderule]", "GradeRules", "[GoalName]= " &
"'" & Me.[GoalName] & "'" & " And [GradeReq] = " & "'" & Me.[GradeReq1] & "'")
Me.Rule = cersGoalRule
Exit_Report_Activate:
Exit Sub
Err_Report_Activate:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Report_Activate
End Sub
What I am hopeing to avoid is to be able to change goals for our associates
in the table and not have to reprogram the report.