Append X No of Records from Date

Taff

Registered User.
Local time
Today, 13:01
Joined
Feb 3, 2004
Messages
158
Hi all,

Am a bit stuck with this one.

I have a table "tblReviews" with the following fields:-

Learn_ID
Review_PlannedDate
Review_ActualDate
Reviewer

I have an unbound form with the following txt boxes:-

txtLearn_ID
txtReviewStartDate (Format dd/mm/yyyy)
txtIntervalWks
txtAmountOfReviews (Number)
txtReviewer

What I would like to happen is after I have completed the above fields, appends the rows to my table.

So if

txtLearn_ID = Ajwebb0982
txtReviewStartDate = 01/09/2005
txtIntervalWks = 1
txtAmountOfReviews = 4
txtReviewer = Ann

I would like to Add 4 rows to my table which should look something like the following:-

Learn_ID, Review_PlannedDate, Reviewer
Ajwebb0982, 08/09/2005, Ann
Ajwebb0982, 15/09/2005, Ann
Ajwebb0982, 22/09/2005, Ann
Ajwebb0982, 29/09/2005, Ann

I'm sure it is possible, just stumped on how to go about it. :confused:


Thanks in advance for any help.


Taff.
 
Hi all,

FYI I found the following to work.

Code:
Dim rs As DAO.Recordset
Set rs = CurrentDb.openrecordset("tblReviews")
With rs
  For a = 1 To txtAmountOfReviews
    .AddNew
    !Learn_ID = txtLearn_ID
    !Review_PlannedDate = CDate(txtReviewStartDate) + (a * 7 * txtIntervalWks)
    !Reviewer = txtReviewer
    .Update
  Next a
End With
rs.Close

Taff.
 
Very helpful!!! Thanks for adding your code.
 

Users who are viewing this thread

Back
Top Bottom