Listbox to display existing tables in database

H

hermanko

Hi,

I have a database that will generate Backup Tables on the "main"
underlying table, so that i can incorporated an undo/rollback function
on my switchboard. Each backup table created is named "Backup" plus
concatented with it the Date/Time stamp. for example:

"Backup: 040606 5:20pm" --> this would have been created today, at
5:20pm.

I have a form with a listbox that will show all tables in the current
database with the following code:

Private Sub Form_Load()
Dim accObject As Access.AccessObject
'Fill with Tables
For Each accObject In CurrentData.AllTables
Me.list_tables.AddItem accObject.Name
Next
End Sub

However, it shows ALL existing tables including my "main" table, as
well as a bunch of "MSYS..." system tables. I went to
Tools-->Options-->View tab and make sure the "system objects" was
unchecked as well.

How can i display only my backup tables. I was thinking maybe using
some form of string recognition? Since the number of backups will
increase/decrease depending on the use of the database. Any suggesions
on how to fix the above code (i'm not strong with VB), or another
option?

thanks!
Herman
 
T

TC

Changes in caps:


'Fill with Tables
For Each accObject In CurrentData.AllTables
IF NOT (ACCOBJECT.NAME LIKE "MSYS*") AND _
ACCOBJECT.NAME <> "BLAH" THEN
Me.list_tables.AddItem accObject.Name
END IF
Next

where BLAH is the name of your "main table".

HTH,
TC (MVP Access)
http://tc2.atspace.com
 
Top