calculating multiple dates

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

Guest

I am currently in the process of developing a database that will keep track
of appointments that patients will have in the future. 2 tables; Demographics
and Visits. The visit table will hold future visits patients have. What I am
needing, I am wanting to populate multiple visit records with a calculation
button from a subform. Example, enter patient demographics then based on a
start date, click a calucate weekly appts and the subform will be populated
with the days the patient needs to come in for the next 12 weeks. Is this
even possible. I am stumped.
Thanks for any help.
 
Amy,

You'll need code to do this. Maybe something like so:

Private Sub cmdSomeButton()
Dim db As Database
Dim strSQL As String
Dim intCtr As Integer
Dim dteVisitDate As Date

Set db = CurrentDb
dteVisitDate = Me!txtVisitDate

For intCtr = 1 To 12
dteVisitDate = DateAdd("ww", 1, dteVisitDate)

strSQL = "INSERT INTO tblMyTable (" & _
"PatientID, " & _
"VisitDate) " & _
"VALUES (" & _
Me!txtPatientID & "," & _
CDbl(dteVisitDate) & ")"

db.Execute strSQL, dbFailOnError
Next intCtr

Set db = Nothing
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Canberra, Australia
 
Thank you so much. I figured I would need to code it but for some reason the
brain would not respond..Thanks it helped a lot.
 
Back
Top