Solved: Access 2003 date() expression problem

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

eireguy

Thread Starter
Joined
Oct 10, 2008
Messages
5
Hi everyone,

I wonder if someone can help with the following ? I had an Access '97 database working for a number of years with no difficulty. Now, just to do a cleanup, I formatted a new C drive, installed XP Pro w/SP2, installed Access '03 and copied the database to the new drive. Everything works except for the date() expression in a text box in form view, I can't get it to display the current date. I have tried adding a new box and using expression builder to set it up to display the date, but no joy. When I return to form view from design view, the box shows "#name?". There are no calculations or macros associated with the box, all I want it to do is show the date ! Any help would be much appreciated, thanks, John.
 
Joined
Oct 20, 2004
Messages
7,837
A case like that usually means it is looking for a source that it can't find, as you obviously seem to know. I would try again by deleting the source and then just enter
=Date()
once again.
I assume the rest of the form looks good - oh, and make sure there are no boxes hidden behind your date() box that could be missing their source and are visible.
 

eireguy

Thread Starter
Joined
Oct 10, 2008
Messages
5
Hi Slurpee 55,

Many thanks for your quick reply, I'm afraid it still won't work. I have also tried to use the "insert" option to simply drop a new text box into the form showing the date, but I still get the same "#name?" message. It's as if the database can't "see" the PC clock for some reason. But thanks again for your suggestion, regards, John.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
John, it sounds like you have placed the Date() in the Record Source instead of in the Default Value.
 
Joined
Oct 20, 2004
Messages
7,837
Both work, Tony....however, in the default value you can enter just Date(), in the Record Source you must enter =Date()
I had assumed eireguy just had not written the "=" portion of what he entered.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
But that doesn't "Save" the data to the Table's Record, it only displays it on the Form. :)
 
Joined
Jun 8, 2001
Messages
2,583
I hope it this simple. the correct syntax for control sourse property is "=now()"

--sorry didn't refresh and see slurpee and ODP post
 

eireguy

Thread Starter
Joined
Oct 10, 2008
Messages
5
Hi Everyone,

Just to go over once again what's happening, I have tried all the syntax in all the fields I can think of, and an error message is returned everytime. If it's any clue, I created a new blank database in Access 03 with just one text box on a form. I then used expression builder to show date using "=date()" in the control source box. No problem, the form shows the current date. Exactly the same procedure in my original database returns an error. Remember, the only difference is that my base was created in Access 97 and is now transferred to Access 03. This is the only function that won't work, otherwise it performs just fine. I suppose you might say do I REALLY need a date field that badly ! Still, I'd love to get to the bottom of it.............once again, thanks for all your time, regards, John.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
John, logic would say that during conversion the Form has been corrupted somehow.
Now that it is in 2003 can you delete the problem field and replace it with one that works?
Can you import the form in to your new 2003 database where the Date() does work to see if it works ok in that?
 

eireguy

Thread Starter
Joined
Oct 10, 2008
Messages
5
Hi OBP,

Just before I read your last suggestion, I tried the following. Instead of putting "=Date()" in the text box, I tried "=Now()" to see if that would make a difference. Guess what ? It worked, just showing the current date, as I wanted. Only thing is, I thought "Now" returned date AND time..........I'm not sure what's going on, but I'm where I want to be, maybe if it ain't broke etc is the order of the day here. After your last post I did try deleteing the text box and putting in a new one, but still got the same error message.
 

OBP

Joined
Mar 8, 2005
Messages
19,895
If the Field is formatted to just show the the date then Now() will only show as a Date, but be stored as date & time.
 

eireguy

Thread Starter
Joined
Oct 10, 2008
Messages
5
Thanks for the effort, everyone, all working well now. regards from Ireland, John.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top