Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Database Table Existence

Thread Tools Display Modes
Old 02-05-2002, 10:26 AM
pukleja pukleja is offline
Join Date: Feb 2002
Location: Houston
Posts: 29
Default Database Table Existence

I am trying to set-up an archive in a separate access DB and I need to check for the existence of the DB and the given table which I am trying to create. Any assistance would be greatly appreciated.
Reply With Quote
Old 02-05-2002, 07:09 PM
Timbo's Avatar
Timbo Timbo is offline

Super Moderator
* Guru *
Join Date: May 2001
Location: Bangkok, Thailand
Posts: 10,261

Do you mean:

you have an Access db and you plan to archive data from it, to a separate Access db.
You want to create a routine which will find the archive .mdb, then export records to the corresponding table if that table exists already..


If so, it's not so complicated.
Store the archive .mdb filename in a table and use the Dir() function to verify its existence before running the rest of the routine.

Use your Tools/Options menu and tick the 'Hidden Objects' on the 'View' tab.
Run a query using this SQL:
"SELECT MSysObjects.Name
FROM MSysObjects
WHERE (((MSysObjects.Flags)=0) AND ((MSysObjects.Type)=1))"

Open your archive .mdb and run the same query to compare the tables and add any which are missing (lookup TableDef collection).

Run a separate routine which runs append queries to the archive db for every table in the source .mdb.

"He's not the Messiah. He's a very naughty boy!" - Brian's mum

Can't find the answer? >> Try something new!
Become a Professional
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..