• Spoke too soon (2000 SP3)

    • This topic has 1 reply, 2 voices, and was last updated 21 years ago.
    Author
    Topic
    #404992

    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

    Viewing 0 reply threads
    Author
    Replies
    • #828188

      I don’t understand. At what point do the SetDefaultStartDate and SetDefaultEndDate routines get called? Does the query call just the Get routines? If so, then when are the Set routines called? The 1899 date is the default you get when zero is evaluated as a date.

    Viewing 0 reply threads
    Reply To: Spoke too soon (2000 SP3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: