Updating a date in a data entry form

G

Guest

I would like to be able to data enter on one form data for different days of
a particular month and I would like the date to automatically update itself
on each record after the first record.

For example on the first record I will data enter 4/1/2007 as the date and
then enter in another field the number of items shipped on that day (say 100).

Then on the next record in the form I would like the date to automatically
default to one day leter (4/2/2007 in this example) and then enter the number
of items shipped on that day. I would like to be able to over ride the date
if necessary.

I might have entries on the form for 30 consecutive days and I do not want
to have to data enter each individual date.

I want to be able to see all the data I have entered so I expect to use the
Datasheet View of the form.

Thanks for any help.

Joe

I do not want to enter in
 
K

kingston via AccessMonster.com

You can use the form's OnCurrent event to do something like the following:

1) Check that the date is Null.
2) If the date is Null, look for the maximum date: DMax("DateField","Table").
3) Set date to max. date plus 1.
 
G

Guest

Thanks. I'm pretty new at this. Can you tell me how I would go about doing
this? Thanks.

Joe
 
K

kingston via AccessMonster.com

Open the form in design mode and open the form's Properties window. In the
Event tab, look for the line On Current and select [Event Procedure]. Click
the ... button at the end of the line to open a VB editor. In the editor add:


If IsNull(Me.DateField) Then
Me.DateField = DMax("DateField","TableName") + 1
End If

Obviously, you will have to modify this for your control and table names.
Also, this assumes that you've already got data in the field and that you
want just a very simple date increment. Look up any terms you don't recognize
in Access Help to find out more.
Thanks. I'm pretty new at this. Can you tell me how I would go about doing
this? Thanks.

Joe
You can use the form's OnCurrent event to do something like the following:
[quoted text clipped - 25 lines]
 

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