RunTime Error 2448

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please Help, Whats causing Runtime Error 2448

I have a form with 2 text boxes (OurStartDate & OurEndDate)

On the form Open Event i have the following code:

Me!OurStartDate = CDate("06/04/" & Year(Date))
Me!OurEndDate = DateAdd("d", -1, DateAdd("yyyy", 1, Me!OurStartDate))

The code works fine, but when i link the text boxes to a control source, i
get the error msg. Can you update tables via VBA?? How can i overcome this
error msg
 
it would help if you'll post the text of the error message, rather than just
the numeric code. also, which line of code is the error occurring on?

and btw, if you're hard coding the start date's month/day as "06/04", can't
you just do the same for the end date? like

Me!OurEndDate = CDate("06/03/" & Year(Date) + 1)

hth
 
Thanks for the reply, the error message is "You cant assign a value to this
object, the code brakes at Me!OurStartDate = CDate("06/04/" & Year(Date))
 
Actually, CDate isn't a particular good way to assign dates, as it's one of
the few date-related functions that respect the user's Regional Settings.
Should the user have his/her short date format set to dd/mm/yyyy, it would
be interpretted as 06 March.

Far better is to use the DateSerial function:

Me!OurStartDate = DateSerial(Year(Date), 6, 4)
Me!OurEndDate = DateSerial(Year(Date) - 1, 6, 3)
 
Back
Top