I made a simple public function to set and return a date value (see
below). I have a number of queries that call up the function to get
the "As Of Date," which is typically set to today's date. Occasionally
though, I need to change the "As Of Date" to some date in the past,
and then when I run the queries, they're based on that date in the
past. This generally works fine, but, sometimes, the date gets reset
to something WAY in the past like "1/1/1900 12:00:00AM" (it's always
the same, I just can't recall the exact date).
Once that happens, the only way to get the date to reset to today's
date is to recompile the database. I checked everywhere I was setting
the date to ensure that I was using the right data type. No problems
there. Any ideas? (see code below) Thanks!
Option Compare Database
Option Explicit
Public dteAsOfDate As Date
Function SetAsOfDate(dte As Date)
dteAsOfDate = dte
End Function
Function GetAsOfDate() As Date
GetAsOfDate = dteAsOfDate
End Function
below). I have a number of queries that call up the function to get
the "As Of Date," which is typically set to today's date. Occasionally
though, I need to change the "As Of Date" to some date in the past,
and then when I run the queries, they're based on that date in the
past. This generally works fine, but, sometimes, the date gets reset
to something WAY in the past like "1/1/1900 12:00:00AM" (it's always
the same, I just can't recall the exact date).
Once that happens, the only way to get the date to reset to today's
date is to recompile the database. I checked everywhere I was setting
the date to ensure that I was using the right data type. No problems
there. Any ideas? (see code below) Thanks!
Option Compare Database
Option Explicit
Public dteAsOfDate As Date
Function SetAsOfDate(dte As Date)
dteAsOfDate = dte
End Function
Function GetAsOfDate() As Date
GetAsOfDate = dteAsOfDate
End Function
Comment