D
Dr Steevil
Allen,
I posted this at the end of another thread, but figured since that thread
was over 2 years old I'd start a new post.
I am needing to duplicate records from a parent form and its underlying
child subforms.
I've gone through your method you posted and after a few tries at it, got it
to work for me beautifully. Thanks very much for this! Now on to my problem.
Basically, I need to go one subform more. I have a second subform (which of
course links to the subform above i.e. a parent-child-child relationship. As
I said, the first two I can duplicate using your method, but the "grandchild"
is where I have problems.
Some info: Here are the 3 tables
tblBids
idsBidID (primary)
miscellaneous other fields (i'll leave these out here for simplicity sake)
tblAssemblies
idsAssembliesID (primary)
idsBidID (foreign key in my subform from tblBids)
miscellaneous other fields
tblAssemblyComponents
idsAssemblyComponentsID (primary)
idsAssembliesID (foreign key in sub-subform from tblAssemblies)
miscellaneous other fields
Here's my code to duplicate the parent and first child sub forms (skipping
down to the part that duplicates tblAssemblies):
If Me.[tblAssemblies_subform].Form.RecordsetClone.RecordCount > 0 Then
strSqlAssemblies = "INSERT INTO [tblAssemblies] ( idsBidID,
chrFixtureType, chrFixtureCode ) " & _
"SELECT " & lngID & " As NewID,
chrFixtureType, chrFixtureCode " & _
"FROM [tblAssemblies] WHERE idsBidID = " &
Me.idsBidID & ";"
DBEngine(0)(0).Execute strSqlAssemblies, dbFailOnError
Else
MsgBox "Main record duplicated, but there were no related
records."
End If
Again, that works great, just need to know how to go about duplicating the
records for tblAssemblyComponents_subform.
By the way, the whole purpose of this is to enable me to build a bid then
build another bid by copying another similar one and just making some changes
to it.
Thanks for your help. I've bookmarked your site too and have gained quite a
few valuable insights from it. I love trying to figure this stuff out and
don't usually ask for help (preferring to find it on my own then work through
it to make it work for me).
I posted this at the end of another thread, but figured since that thread
was over 2 years old I'd start a new post.
I am needing to duplicate records from a parent form and its underlying
child subforms.
I've gone through your method you posted and after a few tries at it, got it
to work for me beautifully. Thanks very much for this! Now on to my problem.
Basically, I need to go one subform more. I have a second subform (which of
course links to the subform above i.e. a parent-child-child relationship. As
I said, the first two I can duplicate using your method, but the "grandchild"
is where I have problems.
Some info: Here are the 3 tables
tblBids
idsBidID (primary)
miscellaneous other fields (i'll leave these out here for simplicity sake)
tblAssemblies
idsAssembliesID (primary)
idsBidID (foreign key in my subform from tblBids)
miscellaneous other fields
tblAssemblyComponents
idsAssemblyComponentsID (primary)
idsAssembliesID (foreign key in sub-subform from tblAssemblies)
miscellaneous other fields
Here's my code to duplicate the parent and first child sub forms (skipping
down to the part that duplicates tblAssemblies):
If Me.[tblAssemblies_subform].Form.RecordsetClone.RecordCount > 0 Then
strSqlAssemblies = "INSERT INTO [tblAssemblies] ( idsBidID,
chrFixtureType, chrFixtureCode ) " & _
"SELECT " & lngID & " As NewID,
chrFixtureType, chrFixtureCode " & _
"FROM [tblAssemblies] WHERE idsBidID = " &
Me.idsBidID & ";"
DBEngine(0)(0).Execute strSqlAssemblies, dbFailOnError
Else
MsgBox "Main record duplicated, but there were no related
records."
End If
Again, that works great, just need to know how to go about duplicating the
records for tblAssemblyComponents_subform.
By the way, the whole purpose of this is to enable me to build a bid then
build another bid by copying another similar one and just making some changes
to it.
Thanks for your help. I've bookmarked your site too and have gained quite a
few valuable insights from it. I love trying to figure this stuff out and
don't usually ask for help (preferring to find it on my own then work through
it to make it work for me).