Date Returns Null

G

Guest

I am trying to set the date control on a form to the current date. The code
I am using is:

Me![OrderDate] = Date

but date always returns Null. It works fine if I try using Now instead
though. Any ideas?

Troy W.
 
K

Ken Snell [MVP]

Do you have a field or control named Date in the form? You are confusing
ACCESS because it doesn't know that you want the function. Change the name
of the field and control.

Do not use Date as the name of a table's or query's field. It 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
 
G

Guest

Ken,
Ok I changed the field name and the control name to PurchaseDate. The
code looks like:
Me![PurchaseDate] = Date

Now I get an error saying that Access can't find the field 'Date' that I
refer to. Ideas?

Troy W.

Ken Snell said:
Do you have a field or control named Date in the form? You are confusing
ACCESS because it doesn't know that you want the function. Change the name
of the field and control.

Do not use Date as the name of a table's or query's field. It 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


--

Ken Snell
<MS ACCESS MVP>

Troy W. said:
I am trying to set the date control on a form to the current date. The
code
I am using is:

Me![OrderDate] = Date

but date always returns Null. It works fine if I try using Now instead
though. Any ideas?

Troy W.
 
J

John Vinson

Now I get an error saying that Access can't find the field 'Date' that I
refer to. Ideas?

This appears to be the very common References bug. Open any
module in design view, or open the VBA editor by typing
Ctrl-G. Select Tools... References from the menu. One of the
..DLL files required by Access will probably be marked
MISSING. Uncheck it, recheck it, close and open Access.

If none are MISSING, check any reference; close and open
Access; then uncheck it again. This will force Access to
relink the libraries.

John W. Vinson[MVP]
 
K

Ken Snell [MVP]

Try Date().

You may need to delete the PurchaseDate control, save the form, close
ACCESS, and restart the program. Then put the control back in the form with
the correct name.

--

Ken Snell
<MS ACCESS MVP>

Troy W. said:
Ken,
Ok I changed the field name and the control name to PurchaseDate. The
code looks like:
Me![PurchaseDate] = Date

Now I get an error saying that Access can't find the field 'Date' that I
refer to. Ideas?

Troy W.

Ken Snell said:
Do you have a field or control named Date in the form? You are confusing
ACCESS because it doesn't know that you want the function. Change the
name
of the field and control.

Do not use Date as the name of a table's or query's field. It 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


--

Ken Snell
<MS ACCESS MVP>

Troy W. said:
I am trying to set the date control on a form to the current date. The
code
I am using is:

Me![OrderDate] = Date

but date always returns Null. It works fine if I try using Now instead
though. Any ideas?

Troy W.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top