I asked previously how to "add new records with dates", and received an excellent response.
However, I had pared my question to what seemed to me the important fields; now I discover that I should have included more fields.
This was the response that I used:-
Private Sub AddVisits_Click()
Dim iFreq As Integer
Dim iInterval As Integer
Dim ddate As Date
iFreq = Me.txFreq
iInterval = Me.Txinterval
ddate = Me.TxStart
Dim i As Integer
For i = 1 To iFreq
CurrentDb.Execute "INSERT INTO TblActivity([ActivityDate]) VALUES(#" & Format(ddate, "mm/dd/yyyy") & "#)"
ddate = DateAdd("d", ddate, iInterval)
Next i
End Sub
What I need in addition is to have it add other fields - e.g., worksid, type, jobid. These fields do not need to be updated, simply repreated.. How do I add them to the code?
CurrentDb.Execute "INSERT INTO TblActivity([ActivityDate]
Assumptions:
Type is text
Worksid and JobID are numeric
You have controls or fields on your form for these items
The syntax may vary if those assumptions don't hold true.