Results 1 to 3 of 3
  1. #1
    DarkWolff is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    29

    Question Programmatically Get Backend Table List


    Is there a way to programmatically get a list of the tables in a backend?

    I have a database that periodically makes a backup of a specific table in a backend with a name based on the date/time the table was copied. I want to be able to get the list of those backup tables to populate a combobox (which will be used later to retrieve the data for viewing).

    I know I could keep a record of the names of the backuptables as they are added and just use that, but I was wondering if there was a method that would allow me to do this without having to do so.

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I found code you would have to modify:
    Code:
     
      '---------------------------------------------------------------------------------------
      ' Procedure : RecordCountRemoteTables
      ' DateTime  : 1/29/2008
      ' Author    : Patrick Wood  http://gainingaccess.net
      ' Purpose   : Count and list all table names and each table's recordcount in remote DB
      ' Arguments : DBPath--A string that is the full path and name of a remote Database
      ' Example   : RecordCountRemoteTables("C:\MyDatabases\MyDatabase.mdb")
      ' Usage     : You are welcome to use and modify this code
      '           : if you leave this header intact.
      '---------------------------------------------------------------------------------------
      '
      Sub RecordCountRemoteTables(DbPath As String)
      
         Dim dbs As DAO.Database
         Dim tdf As DAO.TableDef
         Dim rct As Long
         Dim intcount As Integer
             intcount = 0
      
         Set dbs = OpenDatabase(DbPath)
      
         Debug.Print Now()
         Debug.Print dbs.Name
         Debug.Print "Count | TableName | RecordCount"
         Debug.Print "-------------------------------"
      
         For Each tdf In dbs.TableDefs
             rct = tdf.RecordCount
             intcount = intcount + 1
             Debug.Print intcount & " " & tdf.Name & " " & rct
         Next tdf
      
    
         Set tdf = Nothing
    
         Set dbs = Nothing
    
      
    
      End Sub
    Depending on the number of table, you could write the table names to a combo box value list or a temp table and use the temp table (query) as the row source.


    The site is http://gainingaccess.net/GainingAcce...esDocument.htm

  3. #3
    DarkWolff is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    29
    Thanks! This is exactly what I was looking for.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. break the link to a backend table
    By markjkubicki in forum Programming
    Replies: 1
    Last Post: 06-28-2013, 10:49 PM
  2. Replies: 5
    Last Post: 05-09-2013, 06:47 PM
  3. unable to append a feild to a backend table
    By markjkubicki in forum Programming
    Replies: 2
    Last Post: 02-11-2013, 04:34 PM
  4. Protecting backend table data
    By uncletreetrunk in forum Security
    Replies: 1
    Last Post: 07-30-2012, 09:51 AM
  5. Programmatically add a field to an existing table
    By lpdds in forum Database Design
    Replies: 2
    Last Post: 11-10-2009, 12:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums