Update in Form/table

  • Thread starter Thread starter mortonsafari
  • Start date Start date
M

mortonsafari

I have a table (t_Quote) in which I have two fields that
are related - the first puts a Employee Code (EmpCode)
eg.1, 2, 3 etc, based on their salary level; the second I
want to reflect their relevant pay rate /hour (PayRate)
(but don't want to have to input the data as it is
already stored in another table (t_CostRate).
This PayRate per hour comes from a table (t_CostRate)
which has the EmpCode and PayRate (I have the pay rate
separate as this can change annually).
I have a quote form which has the two fields in it, and
what I would like to be able to do is have the PayRate
field update automatically based on the relevant value in
the EmpCode field eg. if EmpCode = 1 put in a rate value
from t_CostRate where EmpCode = 1 and Rate then =$100;
where EmpCode = 2 and Rate then =$120; where EmpCode = 3
and Rate then =$140 etc.
I can get code to work where I put something simple like
Me.PayRate = IIf([EmpCode] = 1, 100, 999), but then I
have to go into the code to change the rates every time
there is a pay increase.
Any thoughts out there??? Appreciate your help. . .
 
mortonsafari said:
I have a table (t_Quote) in which I have two fields that
are related - the first puts a Employee Code (EmpCode)
eg.1, 2, 3 etc, based on their salary level; the second I
want to reflect their relevant pay rate /hour (PayRate)
(but don't want to have to input the data as it is
already stored in another table (t_CostRate).
This PayRate per hour comes from a table (t_CostRate)
which has the EmpCode and PayRate (I have the pay rate
separate as this can change annually).
I have a quote form which has the two fields in it, and
what I would like to be able to do is have the PayRate
field update automatically based on the relevant value in
the EmpCode field eg. if EmpCode = 1 put in a rate value
from t_CostRate where EmpCode = 1 and Rate then =$100;
where EmpCode = 2 and Rate then =$120; where EmpCode = 3
and Rate then =$140 etc.
I can get code to work where I put something simple like
Me.PayRate = IIf([EmpCode] = 1, 100, 999), but then I
have to go into the code to change the rates every time
there is a pay increase.
Any thoughts out there??? Appreciate your help. . .

Me.PayRate = Dlookup("PayRate","t_CostRate","EmpCode=" & [EmpCode])
 
Back
Top