G
Guest
Using Access 2003 on Windows XP although most of the code was originally
Access 97
I have an Application.mdb front end that contects to a data.mdb. There are
many of these data.mdb's that are identical in structure but each is a
different scenario for a model. We have had Comparison form that allows us to
to select (not necessarily the one we are currently connected to) two
different data.mdb and ct which tables to compare and the create either a
summary or detailed report. One of the things we check for are records in db1
not in db2 and visa versa. For one of the data tables (120+ fields) I have
been asked to modify the reports so the "Indb1notdb2" and "Indb2notdb1"
records are copied to separate tables.
I have created two tables that are in the application.mdb.
Here are the relavent sections of code (which resides inside a function
called by the report buttons).
'-- here are the assignments near beginning of function
Set ws = CreateWorkspace("", "admin", "", dbUseJet)
Set db1 = ws.OpenDatabase(Me!cboMDB1, False)
Set db2 = ws.OpenDatabase(Me!cboMDB2, False)
Set td1 = db1.TableDefs(sTable)
'sTable is a string variable with current table name passed to function by
the form
Set td2 = db2.TableDefs(sTable)
' -- and later for recordsets
Set rs1 = td1.OpenRecordset(dbOpenTable)
Set rs2 = td2.OpenRecordset(dbOpenTable)
rs1.MoveFirst
rs2.MoveFirst
Do While Not rs1.EOF
' many lines of code for other functions of the code
If rs2.NoMatch Then
If sTable = "OPRRIG" Then
sSQL = "INSERT INTO tblOprrig_In1_Not_In2 SELECT FROM rs1.Value"
DoCmd.SetWarnings False
DoCmd.RunSQL sSQL
DoCmd.SetWarnings True
I've tried many variations for sSQL (like - rs1.Fields(*).value) none which
have come close to working. I know I have access to the rs1 as I've used it
for the report with code like
sTitle = rs1.Fields("Name").Value
sType = rs1.Fields("Type").Value
So any help would be appreciated
Access 97
I have an Application.mdb front end that contects to a data.mdb. There are
many of these data.mdb's that are identical in structure but each is a
different scenario for a model. We have had Comparison form that allows us to
to select (not necessarily the one we are currently connected to) two
different data.mdb and ct which tables to compare and the create either a
summary or detailed report. One of the things we check for are records in db1
not in db2 and visa versa. For one of the data tables (120+ fields) I have
been asked to modify the reports so the "Indb1notdb2" and "Indb2notdb1"
records are copied to separate tables.
I have created two tables that are in the application.mdb.
Here are the relavent sections of code (which resides inside a function
called by the report buttons).
'-- here are the assignments near beginning of function
Set ws = CreateWorkspace("", "admin", "", dbUseJet)
Set db1 = ws.OpenDatabase(Me!cboMDB1, False)
Set db2 = ws.OpenDatabase(Me!cboMDB2, False)
Set td1 = db1.TableDefs(sTable)
'sTable is a string variable with current table name passed to function by
the form
Set td2 = db2.TableDefs(sTable)
' -- and later for recordsets
Set rs1 = td1.OpenRecordset(dbOpenTable)
Set rs2 = td2.OpenRecordset(dbOpenTable)
rs1.MoveFirst
rs2.MoveFirst
Do While Not rs1.EOF
' many lines of code for other functions of the code
If rs2.NoMatch Then
If sTable = "OPRRIG" Then
sSQL = "INSERT INTO tblOprrig_In1_Not_In2 SELECT FROM rs1.Value"
DoCmd.SetWarnings False
DoCmd.RunSQL sSQL
DoCmd.SetWarnings True
I've tried many variations for sSQL (like - rs1.Fields(*).value) none which
have come close to working. I know I have access to the rs1 as I've used it
for the report with code like
sTitle = rs1.Fields("Name").Value
sType = rs1.Fields("Type").Value
So any help would be appreciated