L
Lucky
I need to create a custom function that will convert any
date into pay period. I have the pay period information
stored in a separate table (contains PP number, PP start
and end date).
The dates I need to convert may fall on the start/end
date or in between. This function will be used in
queries with no relationship to PP table. I have tried
to use a Dlookup but can not may it work.
Here is the example that does not work for me:
Function GetPayPeriod(strDate As String) As Integer
On Error GoTo GetPayPeriod_Err
Dim varPP As Variant
varPP = DLookup("[PAY_PERIOD_NUM]", "tbl_PayPeriod", _
"[PAY_PERIOD_SRT_DTE] >= " & strDate & " And
[PAY_PERIOD_END_DTE] <= " & strDate )
GetPayPeriod = varPP
Exit Function
GetPayPeriod_Err:
Exit Function
End Function
Any idea how to do this or a resource where I can find
out how?
Thank you for help.
Lucky
date into pay period. I have the pay period information
stored in a separate table (contains PP number, PP start
and end date).
The dates I need to convert may fall on the start/end
date or in between. This function will be used in
queries with no relationship to PP table. I have tried
to use a Dlookup but can not may it work.
Here is the example that does not work for me:
Function GetPayPeriod(strDate As String) As Integer
On Error GoTo GetPayPeriod_Err
Dim varPP As Variant
varPP = DLookup("[PAY_PERIOD_NUM]", "tbl_PayPeriod", _
"[PAY_PERIOD_SRT_DTE] >= " & strDate & " And
[PAY_PERIOD_END_DTE] <= " & strDate )
GetPayPeriod = varPP
Exit Function
GetPayPeriod_Err:
Exit Function
End Function
Any idea how to do this or a resource where I can find
out how?
Thank you for help.
Lucky