B
Ben8765
Hi,
I would like to get the record count of a table in an external database
(using the name of the table in the loop of the current database).
What I've tried (doesn't work):
SourceDbCount = DCount("*", "[GOOD_DATA_SAR_Recovery_Tracking_db.mdb].[" &
rs!Name & "]")
The procedure (**** is where the problem line is):
------------------------------
Public Sub AppendTableRecords()
Dim strSelectAllTables As String
strSelectAllTables = "SELECT NAME FROM MSysObjects WHERE Type=1 AND Name not
like 'MSys%';"
Dim rs As New ADODB.Recordset
rs.Open strSelectAllTables, CurrentProject.Connection, _
adOpenKeyset, adLockOptimistic
DoCmd.SetWarnings False
While Not rs.EOF
DestinationDbCount = DCount("*", rs!Name)
'****
SourceDbCount = DCount("*", "[GOOD_DATA_SAR_Recovery_Tracking_db.mdb].[" &
rs!Name & "]")
'****
CountDifference = SourceDbCount - DestinationDbCount
rs.MoveNext
Wend
DoCmd.SetWarnings True
rs.Close
Set rs = Nothing
Close #iFileNo
End Sub
---------------------------
How can I get the record count of a table in an external db using 'rs!Name'
as the external database's table name?
-Ben
I would like to get the record count of a table in an external database
(using the name of the table in the loop of the current database).
What I've tried (doesn't work):
SourceDbCount = DCount("*", "[GOOD_DATA_SAR_Recovery_Tracking_db.mdb].[" &
rs!Name & "]")
The procedure (**** is where the problem line is):
------------------------------
Public Sub AppendTableRecords()
Dim strSelectAllTables As String
strSelectAllTables = "SELECT NAME FROM MSysObjects WHERE Type=1 AND Name not
like 'MSys%';"
Dim rs As New ADODB.Recordset
rs.Open strSelectAllTables, CurrentProject.Connection, _
adOpenKeyset, adLockOptimistic
DoCmd.SetWarnings False
While Not rs.EOF
DestinationDbCount = DCount("*", rs!Name)
'****
SourceDbCount = DCount("*", "[GOOD_DATA_SAR_Recovery_Tracking_db.mdb].[" &
rs!Name & "]")
'****
CountDifference = SourceDbCount - DestinationDbCount
rs.MoveNext
Wend
DoCmd.SetWarnings True
rs.Close
Set rs = Nothing
Close #iFileNo
End Sub
---------------------------
How can I get the record count of a table in an external db using 'rs!Name'
as the external database's table name?
-Ben