Hi,
Through google, I found a code for a public function that retrieves the fiscal period from a table by evaluating dates. The table is structured as follows:
tblFiscalPeriod s
StartDate (Date/Time)
EndDate (Date/Time)
PK: FiscalPeriodID (Autonumber)
Here is the public function that I copy and pasted:
I tried to display it as a field in a query by creating a field like this:
Period: fFiscalPeriod([POSDAT])
When I try and run the query, it gives me an error message saying "Undefined function 'fFiscalPeriod' in expression."
Can anyone help me to get this thing to work? I have never tried to do any public functions before and I know next to nothing on using them.
Thanks in advance,
Raza
Through google, I found a code for a public function that retrieves the fiscal period from a table by evaluating dates. The table is structured as follows:
tblFiscalPeriod s
StartDate (Date/Time)
EndDate (Date/Time)
PK: FiscalPeriodID (Autonumber)
Here is the public function that I copy and pasted:
Code:
Public Function fFiscalperiod(dteDate As Date) As Integer
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("tblFiscalPeriods")
rs.FindFirst "[StartDate] < #" & dteDate & "#"
fFiscalperiod = rs.Fields("FiscalPeriodID")
End Function
Period: fFiscalPeriod([POSDAT])
When I try and run the query, it gives me an error message saying "Undefined function 'fFiscalPeriod' in expression."
Can anyone help me to get this thing to work? I have never tried to do any public functions before and I know next to nothing on using them.
Thanks in advance,
Raza
Comment