arnelgp
..forever waiting... waiting for jellybean!
- Local time
- Today, 21:08
- Joined
- May 7, 2009
- Messages
- 19,233
You cn use Public function ti get the current rate feim your table:
Public function effectiveRate(empID as string,periodEnd as date) as double
Dim rs as dao.recordset
On error resume next
Set rs=currentdb.openrecordset( _
"Select top 1 [monthly rate] from EmpRates where empID='" & empID & " and [effective date]<=#" & format(periodEnd, "mm/dd/yyyy") & "# order by [effective date] desc")
If not (rs.bof and rs.eof) then
effectiveRate=rs(0)
End if
Rs.close
Set rs=nothing
End function
'Xxx
Call the function from current event of form and afterupdate event of empid.
Public function effectiveRate(empID as string,periodEnd as date) as double
Dim rs as dao.recordset
On error resume next
Set rs=currentdb.openrecordset( _
"Select top 1 [monthly rate] from EmpRates where empID='" & empID & " and [effective date]<=#" & format(periodEnd, "mm/dd/yyyy") & "# order by [effective date] desc")
If not (rs.bof and rs.eof) then
effectiveRate=rs(0)
End if
Rs.close
Set rs=nothing
End function
'Xxx
Call the function from current event of form and afterupdate event of empid.