troubleshooting Question

adding new record with details of previous record

Avatar of msmerry
msmerryFlag for Australia asked on
Microsoft AccessMicrosoft Applications
13 Comments3 Solutions323 ViewsLast Modified:
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?
Join our community to see this answer!
Unlock 3 Answers and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros