Make the date stay

A

albycindy

I have two forms linked to the same table (one with part information, one
with full table information) and I need a field in the first form with the
date and time this record was started. (ie, open form, fill in details,
date/time autofill and stay)

I can get the Date/Time Now function thing to work but, of course, every
time I open the form the date and time changes to current date/time but not
the date/time the record was originally begun.

If you reply with SQL or something similar answer, please explain fully as I
am intermediate Access user.

TIA
 
O

Ofer

All you need to do is to put a now() default in the date field, so every time
you add a new record the field will be filled automatically, without code.

If you want to change the date every time you update the record, then you
should update the date field on the before update event of the form.
Me.FieldName=Now()
 
A

albycindy

Thanks Ofer, but that's the part I know how to do! What I need to do is
create a new record with that =now() function but next time I open that
record it needs to have the original date and time the record was begun. i
just tried it and the date and time entered fine as 17/08/05 10:56:32 so I
created the record, closed etc. When I went back to that record however, the
time was changed to 10:58:58. I need it to say the original
date/time...basically once that now function has done its thing on that
record, it needs to freeze the value in that field.

Is that understandable? totally belive you if it isn't......im confused!
 
O

Ofer

Check the code, in the on load event or the unload event, mybe you have
somewhere in the code that you assign now to the field.
Remove it, put the now() in the default property of the field in form or in
the table.
There is no need to assign the now value to the field using VBA

So check the code and remove it.
 
A

albycindy

Done that...still changing the time.

Ofer said:
Check the code, in the on load event or the unload event, mybe you have
somewhere in the code that you assign now to the field.
Remove it, put the now() in the default property of the field in form or in
the table.
There is no need to assign the now value to the field using VBA

So check the code and remove it.
 
O

Ofer

It's hard to find the problem without looking at the form, so I'm going to
ask things for you to check
1. Assume you check the code, and there is now where you assign a value to
the date field in the table.
2. Is the field in the form bounded to
=Now
Or to a field in the table
If it;s bounded to =now, change it to the field in the table.
3. Do you run any update or insert queries in the form?
4. Can you post all the code you have in the form?
 
A

albycindy

Truthfully....?

Bits of that is over my head at this stage!

1. All code deleted ( I think you are referring to the Visual Basic thing..)
2. At the moment the field is bound to the =now() function in the form, but
i will change that to the table and see what happens
3. Not inserting queries in the table or running updates
4. heh???

Thanks!! :)
 
R

Rick Brandt

albycindy said:
Truthfully....?

Bits of that is over my head at this stage!

1. All code deleted ( I think you are referring to the Visual Basic
thing..)
2. At the moment the field is bound to the =now() function in the

The control should be bound to a field in your table with a DefaultValue
property set to Now(). If you have Now() in the ControlSource that is why it is
always changing and not saving to the table.
 
A

Arvin Meyer [MVP]

You are using the ControlSource property. Open the property sheet. Click on
the Data tab. In the DefaultValue property type: = Now()

That ONLY works on new records, as existing records do not have a
defaultvalue for any fields.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
A

albycindy

That's what I've done. In the Design view of my table, I go to the Default
box and have typed in NOW()

I have added that field to my form but now the field is just blank. I can
enter a date but I want access to do that automatically.
 
A

albycindy

Worry not!!! I have done that and it is fixed!

I put an = sign in front of the NOW() command...maybe that did it?

Thanks for your help!!
 
R

Rick Brandt

albycindy said:
That's what I've done. In the Design view of my table, I go to the
Default box and have typed in NOW()

I have added that field to my form but now the field is just blank.
I can enter a date but I want access to do that automatically.

Did you bind the TextBox on your form to that field and did you go to a new
blank record? The default value will not affect existing records.
 
Top