I needed a way to set default start and end dates for queries and have had this going beautifully (thanks to Hans) for over a month. Today it decided to play up. Default dates last for 1 “occassion” eg one running of a query, then the dates are reset to 1899. I dont know what I have done wrong but appreciate any help.
Symptons are:
I set the default start and end dates using a pop up input box on my switchboard (see code below)
This works once then I get a Runtime error 11 Division by zero
When I check my default dates, they have been reset to 1899
Code is
Option Compare Database
Public DefaultStartDate As Date
Public DefaultEndDate As Date
Public Sub SetDefaultStartDate()
DefaultStartDate = InputBox(“Enter Default StartDate”)
End Sub
Public Function GetDefaultStartDate() As Date
GetDefaultStartDate = DefaultStartDate
End Function
Public Sub SetDefaultEndDate()
DefaultEndDate = InputBox(“Enter Default End Date”)
End Sub
Public Function GetDefaultEndDate() As Date
GetDefaultEndDate = DefaultEndDate
End Function
Have done a compact and Repair with no effect
TIA
Steve