I worked up this little routine and it is doing what I think you need it to do.
I created a Table called tblCourses with 4 fields:
1. ID [Primary Key, [Text - (but contains numbers)]
2. Description [Text]
3. StartDate [Date]
4. StartTime [Date].
I had to increment the ID because it is the Primary Key field in my table.
My Form displays one record at a time and in addition to the 4 fields from the Table, has a textbox named txtDuplications & a button named cmdUpdate.
Here is the code for the button:
Code:
Private Sub cmdUpdate_Click()
Dim ID, CourseDesc, StrSQL As String
Dim i, j, intID, intDuplications As Integer
Dim StartDate, StartTime As Date
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("tblCourses")
DoCmd.SetWarnings False
intID = DMax("ID", "tblCourses")
Me.Description.SetFocus
CourseDesc = Me.Description.Text
Me.StartDate.SetFocus
StartDate = Me.StartDate.Value
Me.StartTime.SetFocus
StartTime = Me.StartTime.Value
Me.txtDuplications.SetFocus
intDuplications = Me.txtDuplications.Value
For i = 1 To intDuplications
intID = intID + 1
StrSQL = "INSERT INTO tblCourses (ID, Description, StartDate, StartTime) "
StrSQL = StrSQL & "VALUES (" & intID & ", " & "'" & CourseDesc & "'" & ", #" & StartDate & "#, #" & StartTime & "#); "
'I used this message box to make sure my sql was correct.
'MsgBox "SQL before RunSQL command: " & StrSQL
DoCmd.RunSQL StrSQL
Next
DoCmd.SetWarnings True
End Sub
Let me know if this works for you!