Auto Populate Table

darreno

Registered User.
Local time
Yesterday, 19:19
Joined
Jun 16, 2007
Messages
54
I am trying to design a database to replace an Excel worksheet that I am currently using and need help to figure it out. Quite simple actually:)

If I purchase an item with deliveries of 400 units per day starting from Jan-1 2008 thru Mar-31 2008, how can I auto populate the table with the monthly quantities like so:

Jan 2008 12,400 units
Feb 2008 11,600 units
Mar 2008 12,400 units

The monthly range could go up to 36 months. I have design a form to input the purchase and appreciate any advice. Attached is the DB.
 

Attachments

I hope you can program VBA.
Pseudocode:
Code:
lngWorkingMonth = clng(format(startdate,"yyyymm"))
lngEndmonth = clng(format(enddate,"yyyymm"))

Do While lngworkingMonth <= lngEndmonth
  currentdb.execute "Insert into tabel (field1, field2) values ( daysofmonth(lngWorkingMonth), lngworkingMonth)
  lngWorkingmonth = lngWorkingmonth + 1
Loop

You need to work out DaysOfMonth function

Enjoy!
 

Users who are viewing this thread

Back
Top Bottom