Append multiple records to SAME table using 1 form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I have a very simple table that takes as input 3 values - one of which are dates. The data for the table comes on a weekly basis, one entry for each day of the week. In keeping with the paper form, I would like to create a form where the user enters the first day of the week, then in a subform (for that employee), the values can be input - 1 week at a time.

I have created an input form with unbound date boxes - once the date for Monday is put in, the other dates automatically populate. I have unbound text boxes for the other info as well. What is the best way to add all these records to my table? I'm hoping there is some simple code I can use..

Thanks
Carrie
 
Carrie said:
Hello,

I have a very simple table that takes as input 3 values - one of which
are dates. The data for the table comes on a weekly basis, one entry for
each day of the week. In keeping with the paper form, I would like to
create a form where the user enters the first day of the week, then in a
subform (for that employee), the values can be input - 1 week at a time.
I have created an input form with unbound date boxes - once the date for
Monday is put in, the other dates automatically populate. I have unbound
text boxes for the other info as well. What is the best way to add all
these records to my table? I'm hoping there is some simple code I can
use...You will need a loop of some sort and the following is close but untested.
AddSQLRecord(EmployeeID, StartDate)
Dim TemDate as Date, I as Integer
TempDate = StartDate
For I = 1 to 7
strSQL = "INSERT INTO billdone (EmpID , Tempdate) VALUES ( '"
strSQL = strSQL & EmployeeID & "', '" & StartDate & "')"
DoCmd.RunSQL strSQL
TempDate = dateAdd("d",1, Tempdate)

Next I

'then requery the form
 
Back
Top