'Duplicate the related records: append query.
If Me.[Pre_Installation_SiteSurvey
subform].Form.RecordsetClone.RecordCount > 0 Then
strSql = "INSERT INTO [Pre_Installation_SiteSurvey] (
lngProgramID, PreInstallationID, [Scheduled Week No], [Completed Week],
[Survey By], Paperwork)" & _
"SELECT " & lngID & " As
lngProgramID,PreInstallationID,[Scheduled Week No],[Completed
Week],[Survey
By], Paperwork " & _
"FROM [Pre_Installation_SiteSurvey] WHERE lngProgramID=
" & Me.txtProgramID & ";"
Debug.Print strSql
Set Duplicate = dbs.OpenRecordset(strSql, dbOpenDynaset,
dbSeeChanges)
DBEngine(0)(0).Execute strSql, dbFailOnError
Else
MsgBox "Main record duplicated, but there were no related
records."
End If
Barry said:
I have got past this part of the code, I am using an SQL server to store
the
data but now i receive an error " You must use dbSeeChanges option with
OpenRecordSet when accessing an SQL server table that has an identity
column"
I have tried the following statement but i then get an error "Object
required"
Set Duplicate = dbs.OpenRecordset(strSql, dbOpenDynaset, dbSeeChanges)
This gives duplicate a value of empty???
Can you help me...