J
Jim Evans
I have a query that gets Sales records by a date range. The Criteria for the
Date Range Calls 2 Functions :\Between FromDate() and ToDate().
The Module code for the Functions:
Public Function ToDate() As Date
'Written by Helen Feddema 9/14/98
'Last modified 7-4-2002
On Error GoTo ErrorHandler
'Pick up To date from Info table
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblInfo", dbOpenTable)
With rst
.MoveFirst
ToDate = Nz(![ToDate], "12/31/2004")
.Close
End With
ErrorHandlerExit:
Exit Function
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit
End Function
Public Function FromDate() As Date
'Written by Helen Feddema 9/14/98
'Last modified 9-2-2003
On Error GoTo ErrorHandler
'Pick up from date from Info table
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblInfo", dbOpenTable)
With rst
.MoveFirst
FromDate = Nz(![FromDate], "1/1/2003")
.Close
End With
ErrorHandlerExit:
Exit Function
When try to preview the Report, I receive the Subject message twice and
then the No Records message.
Can anybody see the problem?
tia,
Jim Evans
Date Range Calls 2 Functions :\Between FromDate() and ToDate().
The Module code for the Functions:
Public Function ToDate() As Date
'Written by Helen Feddema 9/14/98
'Last modified 7-4-2002
On Error GoTo ErrorHandler
'Pick up To date from Info table
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblInfo", dbOpenTable)
With rst
.MoveFirst
ToDate = Nz(![ToDate], "12/31/2004")
.Close
End With
ErrorHandlerExit:
Exit Function
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit
End Function
Public Function FromDate() As Date
'Written by Helen Feddema 9/14/98
'Last modified 9-2-2003
On Error GoTo ErrorHandler
'Pick up from date from Info table
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblInfo", dbOpenTable)
With rst
.MoveFirst
FromDate = Nz(![FromDate], "1/1/2003")
.Close
End With
ErrorHandlerExit:
Exit Function
When try to preview the Report, I receive the Subject message twice and
then the No Records message.
Can anybody see the problem?
tia,
Jim Evans