![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello All I am using Duane Hookums excellent recurring database file and I have modified quite a bit. I have come across a basic problem - the recurring code works great when using a group of check boxes to generate a series of dates. The code runs based on a value "group" in the main form: If Me.grpRepeats = 2 Then 'runs code for recurring dates. However when the choice is single dates these dates are entered individually in a subform, the code updates a single date instead of allowing me to add: i add 12th, 13th & 14th dates (as below) 2011 - Morning , run the code everything works ok, *I change a parameter 12th.13th & 14th *2011 *- Afternoon and run again to create, the update over writes (as you would expect.) What I am need to do is add several single dates and loop through 12-9-2011 Morning etc 13-11-2011 Morning etc 14-12-2011 Morning etc etc change a combo to Afternoon and get a second set of 3 results inserted 12-9-2011 Afternoon etc 13-11-2011 Afternoon etc 14-12-2011 Afternoon etc taking the master form details as set and appending to the table (instead of updating) code is strSQL = "INSERT INTO tblTempSchedDates (" & _ * * * * * * * * * * "tscDate, " & _ * * * * * * * * * * "tscStartTime, tscEndTime, faculty_ID, f_clinicID, discID, sessionID, " & _ * * * * * * * * * * "acc_yearID, acc_termID, tscNotes) " & _ * * * * * * * * * * "Values(#" & datThis & "#, #" & Me.txtStartTime & "#, #" & _ * * * * * * * * * * *Me.txtEndTime & "#," & lngFacID & "," & lngF_clinicID & "," & lngDisciplineID & ", " & _ * * * * * * * * * * *lngSessionID & "," & lngAccYearID & "," & lngAccTermID & "," & _ * * * * * * * * * * IIf(IsNull(varNotes), "Null", """" & varNotes & """") & ")" ' * * * * * * * *Debug.Print strSQL ' * * * *Stop * * * * * * * * DB.Execute strSQL, dbFailOnError * * * * * * End If * * * * * *End If * * * * Next * * *Else *'dates are there, just add the details from main form strSQL = "Update tblTempSchedDates Set f_clinicID = " & lngF_clinicID & ", faculty_ID = " & lngFacID & ",discID = " & lngDisciplineID & ", sessionID = " & lngSessionID & ", acc_yearID = " & lngAccYearID & _ * * * * * * ", acc_termID = " & lngAccTermID & ", tscStartTime =#" & Me.txtStartTime & _ * * * * * * "#, tscEndTime = #" & Me.txtEndTime & "#" This update the current records, and I want to append... What I have tried so far a few variations to tray and replace the 2nd strSQL: Dim rs As Object Dim tDate As Variant tDate = Me.[sfrmTempScheduleEdit]![tscDate] ' this is the subform with the dates Set rs = Me.[sfrmTempScheduleEdit]![tscDate] ' *this is not correct and causing various errors If Me.grpRepeats = 1 Then With rs Do While Not .EOF *strSQL = "INSERT INTO tblTempSchedDates (" & _ * * * * * * * * * * "tscDate, " & _ * * * * * * * * * * "tscStartTime, tscEndTime, faculty_ID, f_clinicID, discID, sessionID, " & _ * * * * * * * * * * "acc_yearID, acc_termID, tscNotes) " & _ * * * * * * * * * * "Values(#" & datThis & "#, #" & Me.txtStartTime & "#, #" & _ * * * * * * * * * * *Me.txtEndTime & "#," & lngFacID & "," & lngF_clinicID & "," & lngDisciplineID & ", " & _ * * * * * * * * * * *lngSessionID & "," & lngAccYearID & "," & lngAccTermID & "," & _ * * * * * * * * * * IIf(IsNull(varNotes), "Null", """" & varNotes & """") & ")" * * * * * * * * * * * * * * * * * * Debug.Print strSQL * * * * * * * * * * DB.Execute strSQL, dbFailOnError .MoveNext Loop End With End If Set rs = Nothing I am missing something basic as this should be simpler than this. Any suggestions would be appreciated Thanks John |
![]() |
| Thread Tools | |
| Display Modes | |
| |