Automatic create records on table

R

Ray

I need to create records on certain fields of a table and look for advice
how to construct the table.

Date field: Every new record will increase by 7 days, i.e., 17/05/05, next
record is 24/05/05.
Number field: Every new record will increase by 1 and recycle after 12
records, ie, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2,.......

Thanks,

Ray
 
S

Steve Schapel

Ray,

You could try using the Default Value of the relevant controls on your
data entry form. In the case of the date field, set the Default Value
to the equivalent of...
DMax("[YourDateField]","YourTable")+7
In the case of the number field, set the Default Value to the equivalent
of...
DCount("*","YourTable") Mod 12 + 1

This will only work if your from is a Single view form. If it is
Continuous view, you will need to use a VBA procedure to assign the
required values.
 
R

Ray

Steve,

Thanks for your useful suggestion. I tried them all and they work as
required.

I have another auto increase number in the format like this, 1, 1, 1, 2, 2,
2, 3, 3, 3,......12, 12, 12, 1, 1, 1,....... Is there any way to format the
field like that?

Your suggested method is working on opening the form and closing the form.
I need to repeat 52 times a year and is there any method to set the number
of records generated.

Thanks,

Ray

Steve Schapel said:
Ray,

You could try using the Default Value of the relevant controls on your
data entry form. In the case of the date field, set the Default Value to
the equivalent of...
DMax("[YourDateField]","YourTable")+7
In the case of the number field, set the Default Value to the equivalent
of...
DCount("*","YourTable") Mod 12 + 1

This will only work if your from is a Single view form. If it is
Continuous view, you will need to use a VBA procedure to assign the
required values.

--
Steve Schapel, Microsoft Access MVP
I need to create records on certain fields of a table and look for advice
how to construct the table.

Date field: Every new record will increase by 7 days, i.e., 17/05/05,
next record is 24/05/05.
Number field: Every new record will increase by 1 and recycle after 12
records, ie, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2,.......

Thanks,

Ray
 

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