I am using this to get a list of Tables from a Remote Database and place the list of Tables into a Listbox.
This is working.
Dim rRemoteDB As String
rRemoteDB = "C:\Test\RemoteDB.accdb"
Me![List40].RowSource = "SELECT [Name] FROM MSysObjects IN '" & rRemoteDB & "'" _
& " WHERE [Type]=1 AND NOT ([Name] Like '~*' OR [Name] Like 'MSys*') ORDER BY 1"
What I would like to do is add a second column to the Listbox that contains a count of the Rows In each of the Remote Database Tables.
This is my (best) Failed Attempt:
Dim rRemoteDB As String
rRemoteDB = "C:\Test\RemoteDB.accdb"
Me![List40].RowSource = "SELECT [Name]," & "DCount(" & Chr(34) & "*" & Chr(34) & ",[Name])" & "AS Rows FROM MSysObjects IN '" & rRemoteDB & "'" & _
'" WHERE ([Type]=1) AND NOT ([Name] Like '~*' OR [Name] Like 'MSys*') ORDER BY 1"
My Failed Attempt;
Returns the Remote Table Names;
Does not return a Row Count for Tables in the Remote Database;
Returns a Row Count If a Table by the same Name is in the Local Database otherwise, the second column is Error.
Any help making this work would be appreciated
Accel45
This is working.
Dim rRemoteDB As String
rRemoteDB = "C:\Test\RemoteDB.accdb"
Me![List40].RowSource = "SELECT [Name] FROM MSysObjects IN '" & rRemoteDB & "'" _
& " WHERE [Type]=1 AND NOT ([Name] Like '~*' OR [Name] Like 'MSys*') ORDER BY 1"
What I would like to do is add a second column to the Listbox that contains a count of the Rows In each of the Remote Database Tables.
This is my (best) Failed Attempt:
Dim rRemoteDB As String
rRemoteDB = "C:\Test\RemoteDB.accdb"
Me![List40].RowSource = "SELECT [Name]," & "DCount(" & Chr(34) & "*" & Chr(34) & ",[Name])" & "AS Rows FROM MSysObjects IN '" & rRemoteDB & "'" & _
'" WHERE ([Type]=1) AND NOT ([Name] Like '~*' OR [Name] Like 'MSys*') ORDER BY 1"
My Failed Attempt;
Returns the Remote Table Names;
Does not return a Row Count for Tables in the Remote Database;
Returns a Row Count If a Table by the same Name is in the Local Database otherwise, the second column is Error.
Any help making this work would be appreciated
Accel45