RasterImage, yes, I added the qdfTemp variable to use the QueryDef execute instead of the string; you might still want ot do that and see what you get. If you can't get it to work maybe create a select query similar to the append one and use dCount to get the number of records or even easier get the tblSession counts before and after insert:
Code:
Dim dbs As DAO.Database 'This database
Dim dtmWCOld As Date 'Original week commencing date
Dim dtmWCNew As Date 'New week commencing
Dim lngNumWks As Long 'Copy to this many weeks in the future
Dim lngUserID As Long 'Staff primary key
Dim strSQL As String 'The append query
Dim lngRowInsrt As Long 'Number of rows copied
Dim strMsg As String 'Message box text
'Copies the current week's sessions to a new week.
Dim lCountBefore as long,lCountAfter as Long 'NEW
On Error GoTo Error_Handler
Set dbs = CurrentDb
dtmWCOld = Forms.frmSessions.txtWC
lngNumWks = Me.txtCopyNoWeeks.Value
dtmWCNew = DateAdd("ww", lngNumWks, dtmWCOld)
lngUserID = Forms.frmMenu.txtUserID
'Copying sessions correctly but Records Affected given as 0.
strSQL = "INSERT INTO tblSession " & _
"(AppointmentID, SessionDate, StartHours, StartMinutes, EndHours, EndMinutes, Online, Typed, HoursTyped, Comments, AttType) " & _
"SELECT tblSession.[AppointmentID], DateAdd('d'," & 7 * lngNumWks & ", tblSession.[SessionDate]), " & _
"tblSession.[StartHours], tblSession.[StartMinutes], tblSession.[EndHours], tblSession.[EndMinutes], tblSession.[Online], tblSession.[Typed], " & _
"-1 * tblSession.[Typed] *((tblSession.[EndHours] + tblSession.[EndMinutes] / 60) - (tblSession.[StartHours] + tblSession.[StartMinutes] / 60)), " & _
"tblSession.[Comments], " & 1 & _
" FROM tlkpScheme " & _
"INNER JOIN ((tblAppointment LEFT JOIN tblStudent ON tblAppointment.[StudentID] = tblStudent.[StudentPK]) " & _
"INNER JOIN tblSession ON tblAppointment.[AppointmentID] = tblSession.[AppointmentID]) " & _
"ON tlkpScheme.[SchemePK] = tblAppointment.[WorkScheme] " & _
"WHERE tblAppointment.[StaffID] = " & lngUserID & _
" AND DatePart('ww', tblSession.[SessionDate], 2) = " & DatePart("ww", dtmWCOld) & _
" AND Year(tblSession.[SessionDate]) = " & Year(dtmWCOld) & ";"
'Save any updates to Copy number of weeks.
If Me.Dirty Then Me.Dirty = False
'Perform the append query.
lCountBefore = dCount("*","tblSession") 'get count BEFORE append
With dbs
.Execute strSQL, dbFailOnError
'lngRowInsrt = .RecordsAffected
lCountAfter = dCount("*","tblSession") 'get count AFTER append
lngRowInsrt=lCountAfter - lCountBefore
End With
Forms.frmSessions.Requery
'Close the dialogue
DoCmd.Close acForm, "fdlgCopySessions", acSavePrompt
'Confirm
strMsg = lngRowInsrt & " sessions copied to w/c " & dtmWCNew & "."
MsgBox strMsg, vbInformation, "Copy confirmation"