473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Find a field in hundreds of tables

I have an Access front-end that has linked tables to an Oracle database;
there are hundreds of linked tables in my front-end.

Is there a way to write some code that goes through every table and
finds all the tables that have fields named "EMPLID" and puts the names
of those tables into another table?

Help is appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
1 2060
The code below should give you a start. I don't see that use of Oracle is
specifically relevant here.

It requires the DAO object library to be included in your application.

You might want to add some error handling and/or restrict the table names
to those not starting with MSys (which are Access internal tables).

Regards

Peter Russell
Sub FindTables()
Dim fName
Dim db As Database
Set db = CurrentDb

Dim tbl As DAO.TableDef
Dim fld As DAO.Field

fName = "EMPLID"

For Each tbl In db.TableDefs

For Each fld In tbl.Fields
If fld.Name = fName Then
InsertRec tbl.Name
Exit For
Else
End If
Next fld

Next tbl

Set db = Nothing
End Sub

Sub InsertRec(vtblname)
' set your own table name (=MyTable) and fieldname (=tablename) where
' results are stored
Dim strSQL
strSQL = "INSERT INTO MyTable (tablename) VALUES ('"
strSQL = strSQL & vtblname & "')"
CurrentDb.Execute strSQL, dbFailOnError
End Sub


Rehmann previously wrote:
I have an Access front-end that has linked tables to an Oracle database;
there are hundreds of linked tables in my front-end.

Is there a way to write some code that goes through every table and
finds all the tables that have fields named "EMPLID" and puts the names
of those tables into another table?

Help is appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeremy | last post by:
I have a pretty straightforward database that is designed to record free-form information about products (date, source and a memo field). This is searched and updated via a form. For new records,...
7
by: OHM | last post by:
OK, before you flame me because this is not an VB/ADO/INTEROP question rather than a VB.NET/ADO.NET/Interop question, I have not had much luck with this so you guys are a last resort. I wonder...
1
by: Lars E | last post by:
Hi all I have a small problem. I have a datatable with 8 columns. But it is only data in 5 of the columns. Data for the remaing 3 columns is in another dataset. I Want to run trough the...
3
by: comp_databases_ms-sqlserver | last post by:
This post is related to SQL server 2000 and SQL Server 2005 all editions. Many of my stored procedures create temporary tables in the code. I want to find a way to find the query plan for these...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.