Date() function

Orit

Registered User.
Local time
Today, 07:20
Joined
Jul 24, 2009
Messages
20
Hi,

I hope that the question on the right form :)

I have two fields A and B where B is automatically update after someone enter data to A.

I'm working with 2007 version.

I put on afterupdate event in field A: B= date()
and on control source at B field : A

It's work but form some reason i got on B field incorrect date ( it gave me a date from 1899)... where in other fields that include date() function I got the correct date.

Can someone help me with this issue?

Thanks a lot
 
The date from 1899 sounds like either a zero date value or a negative one.

The reference date for day zero in Access is (I think) Midnight of 31-Dec-1899. That makes day 1 as 1-Jan-1900.

This might also happen if for some reason the field is being interpreted differently than the others. Finally it depends on when you look.

In the afterupdate event, you update a control. But that doesn't automatically refresh the page or requery the underlying recordset or update the recordset. So B might still have the old value (0) in the control. It will stay that way until a repaint, refresh, requery, or some other event that forces a re-evaluation of the form's displayed contents. The afterupdate event on a control doesn't automatically do any of those (if I recall correctly).
 
Thanks for your answer.

Do you have a solution for this case? I'm not so professional in access and it will be very helpful to me.

Thanks again.
 
The control source of B should be empty, the code supplies the data.

Brian
 
Sorry, still don't work. :confused:

What should be the code?
 
I'm on 2002 .

in a form I put 2 textboxes A and B
I put nothing in the record source.
in the after update event procedure for A i code Me.B = Date()

It works. I.E. when i enter data in A and hit Enter i get the date in B

brian
 
This is exactly what I done but still, it's not working :confused:

I don't understand why I got date for 1899 (31-12-1899) when I call the Date() function.

I'm working with access 2007 and I more then be glad if someone can help on the date issue. all the other works (meaning I can make field B to be automaticlly after hit enter in A field).

Thank a lot all!! :)
 
You get a date function of 31-Dec-1899 if for some reason the computer's internal date is zero (unlikely) or you have a References problem. Search this forum for "References" to see how to fix references.
 
31/12/1899 is actually date value 1

30/12/1899 is date 0

there is another thread on this same issue (same OP, I think)
 
Orit,

In your table, is Field B's Data Type set as Date/Time? Was it ever set as another Data Type?
 
I'm on 2002 .

in a form I put 2 textboxes A and B
I put nothing in the record source.
in the after update event procedure for A i code Me.B = Date()

It works. I.E. when i enter data in A and hit Enter i get the date in B

brian
Brian Hi,

Can you please explain it again, since i did that and it's not working and prbebly I don't do it right.

I just tried it again. Can you tell me if you put the event exactly on A? you enter to A - Properties and then what ? Can you write me the exact way, step by step?



thank you very much
 
Not having 2007 I cannot open the DB posted but it would seem that Bob has answered your problem on the other thread

Brian
 
Not having 2007 I cannot open the DB posted but it would seem that Bob has answered your problem on the other thread

Brian
Brain,

Can you please explain me staep by step how to do it in access 2003 ?


Thanks a lot
 
Having placed your 2 textboxes in the form select properties of box A
select Beforeupdateevent and click on the ... to the right
select codebuilder from the menu that will appear
in the A_beforeupdate code that will now open up code Me.B=Date()

switch to view of form and type something in A press enter and job done.


Brian
 

Users who are viewing this thread

Back
Top Bottom