I need some easy way to have a form auto-populate a table with certain
fields. I'm using a table (for a company's payroll) that records daily
hours for employees. The table has, say, four relevant columns:
EmployeeName, DepartmentCode, Day, HoursWorked
The simplest way I've found of entering the data is to have a form
that, using a filter, picks out all entries where EmployeeName,
DepartmentCode match a chosen set, and where Day is within a range
that is present (one pay period).
Anyway, that part works fine, the problem is that I need some way to
create the 15 or so entries with 0 in the HoursWorked column, so that
my form has something to find.
What I'm looking for, then, is some way to create a macro or script
that will be invoked when opening the form in question. The form is
launched from another form that lets the user choose the data that it
will be filtering by, so it's not hard to get the data input, I just
need the code.
In English, this is what it would need to do:
Create entry in table DailyHours
Set EmployeeName (using the field in the previous form)
Set DepartmentCode (using the field in the previous form)
Set Day = FirstDay (this day is taken from a field that is set once
the pay period is chosen)
Set Hours = 0
Loop, but
Set Day = FirstDay+1
Do until Day = (FirstDay of (PayPeriod+1)) -1 |