Date Function not working

  • Thread starter Thread starter Mark S
  • Start date Start date
M

Mark S

Have databases that have been converted from previous versions,
currently running 2003. Unable to enter the Date function in one of
the form events (or any sub). It will take the date statement but not
the function.

Further, I am trying to populate a bound control with a date.
Currently trying to use the date function but may need to use other
dates (not really the issue yet). But, it will not let me populate
the date from code. If I set the Default Value to = Date(), it works
fine, but can't do it from code. Tried all the following
combinations, with error results shown:

Me.txtStartDateTime = DateValue(date) + TimeValue(Time)
Invalid use of Null

Me.txtStartDateTime = Now
You can’t assign a value to this object

Me.txtStartDateTime = date
You can’t assign a value to this object

I have tried creating a new database and I am able to do this without
any problem and the Date function works fine.

Me.txtStartDateTime = Date()
Worked fine in new database.

I have tried everything I have read in other posts about correcting
References, including removing all unnecessary references and adding
then removing an extra reference after restarting to rebuild the
references.

I have looked through every property I can think of to compare the
converted database to the newly created one. I have started with a
blank database and imported everything to it.

Any suggestions?

BTW, thanks to everyone who has provided help in the past. Whether it
has been answering one of my questions directly or by helping someone
else here, also helping me. THANKS.

Mark
 
Just guessing at the moment, but my guess is that you have a field or
control named Date on the form. ACCESS is probably assuming that you mean
the control or field, not the function.

Do not use Date, Name, etc. as the name of a table's or query's field. They
and many other words are reserved words in ACCESS, and can create serious
confusion for ACCESS and Jet. See these Knowledge Base articles for more
information:

List of reserved words in Access 2002 and Access 2003
http://support.microsoft.com/default.aspx?scid=kb;en-us;286335

List of Microsoft Jet 4.0 reserved words
http://support.microsoft.com/?id=321266

Special characters that you must avoid when you work with Access
databases
http://support.microsoft.com/?id=826763
 
Thanks, I'll bet that's it. Inherited these databases so I will check
when I get back in the office tomorrow.
 
Back
Top