Inserting 7 records at a time.

  • Thread starter Thread starter D Collins
  • Start date Start date
D

D Collins

I have a database where we keep track of daily hours for
an employee per each week. I would like a button on a
form that inserts 7 records with the daily date for each
of the days of that week. That way, the user only has to
fill in the hours instead of having to remember the
actual dates (starting with Sunday through Saturday).
There are several categories of hours (i.e. Reg, OT,
Travel, Holiday, Personal, etc.)

Thanks,
D.
 
I have a database where we keep track of daily hours for
an employee per each week. I would like a button on a
form that inserts 7 records with the daily date for each
of the days of that week. That way, the user only has to
fill in the hours instead of having to remember the
actual dates (starting with Sunday through Saturday).
There are several categories of hours (i.e. Reg, OT,
Travel, Holiday, Personal, etc.)

Thanks,
D.

As a rule, inserting such "placeholder" records is not a good idea.
It's all too easy to insert seven records and only fill three of them
out!

Instead, I'd suggest a Subform; you could have code in the Subform's
AfterUpdate event to automatically default the date of the next
record's date field to the next day:

Private Sub Form_AfterUpdate()
Me!txtDt.DefaultValue = "'" & DateAdd("d", 1, Me!txtDt) & "'"
End Sub

Set the Format property of txtDt to something like

ddd, mm/dd/yy

to show Fri, 03/18/04 so the user doesn't get confused about what day
is which.
 
Back
Top