a field value to default for next record

ahvc

Registered User.
Local time
Today, 23:53
Joined
Jun 17, 2002
Messages
41
Dear friends,
my question is how to make a field value default(copy over) for the next record automatically?

i spent few hours working around the DefaultValue property. In the Afterupdate event, I wrote
Drop_In_Date.DefaultValue = Drop_In_Date.Value,
but that did not help. I also tried it in the oncurrent event of the form, but of no use.

Basically, the drop in date is going to be same for all the records typed in each day. So to make it easy for the user, I wanted to store the first time the date is entered, and then just make it default for each record, until it is changed next day.

Can you pl help.
Thanks
VC
 
Hi

If the date will always be the current date then could you not set the default value to "=NOW()"?

If not then it sounds like what you are asking is for Access to hang on to your date after you've closed or updated your form so that the next form can grab it. If so maybe you could play with a DECLARATION when you open the database...now this is just how I'd work around it and may not be particularly efficient so don't take it as gospel OK?...

dim DATE as variant (don't know if you have to make this a PUBLIC declaration...you do in Excel so that it's carried even when the subroutine has closed.

Then you allocate the value of that declaration in the BeforeUpdate event of the text box on your form. The user then inputs a date. Now, in the AfterUpdate you say that the declaration value is the value of your text box.

This then carries the value outside of the form so that your text box reads the updated value when you next load it up.

Andy
 
VC

I am not sure if I understand precisely what you are trying to do. What I think you are trying to do is this;

I think you want the current date to be placed in the Drop_In_Date field when a new record is added. If this is the case then all you need to do is this;

In design view of your table set the default value of the Drop_In_Date field to =Date(). This will assign the current date to the field by default.

Then in the properties of the Drop_In_Date field on your form; set the locked option to yes; the lock option is on the data tab… This will prevent the date from being changed on the form.

Hope This Helps…

Don
 

Users who are viewing this thread

Back
Top Bottom