Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9135539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:50:16+00:00 2026-06-17T08:50:16+00:00

All tables in a certain database have the exact columns, so I’m wondering if

  • 0

All tables in a certain database have the exact columns, so I’m wondering if there is a way I can query all of them at once for a specific few columns that I know every table will have. The reason I want to do this is that the number of tables in the database will constantly be growing, and I don’t want to have to every day go and change my query to accommodate the names of the new tables.

Help is appreciated as always

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:50:17+00:00Added an answer on June 17, 2026 at 8:50 am

    In that case, try ADO:

    Function ListTablesContainingField(SelectFieldName) As String
       'Tables returned will include linked tables
       'I have added a little error coding. I don't normally do that
       'for examples, so don't read anything into it :) 
       Dim cn As New ADODB.Connection
       Dim rs As ADODB.Recordset
       Dim strTempList As String
    
           On Error GoTo Error_Trap
    
           Set cn = CurrentProject.Connection
    
           'Get names of all tables that have a column called <SelectFieldName>
           Set rs = cn.OpenSchema(adSchemaColumns, _
           Array(Empty, Empty, Empty, SelectFieldName))
    
           'List the tables that have been selected
           While Not rs.EOF
               'Exclude MS system tables
               If Left(rs!Table_Name, 4) <> "MSys" Then
                   strTempList = strTempList & "," & rs!Table_Name
               End If
               rs.MoveNext
           Wend
    
           ListTablesContainingField = Mid(strTempList, 2)
    
       Exit_Here:
    
           rs.Close
           Set cn = Nothing
           Exit Function
    
       Error_Trap:
    
           MsgBox Err.Description
           Resume Exit_Here
       End Function
    

    From: http://wiki.lessthandot.com/index.php/ADO_Schemas

    You might like to consider a table of tables, if you have not already got one, that lists the linked Excel tables and holds details of archive dates etc, because you will run into limits at some stage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a large Oracle database with many tables. Is there a way I
All of my tables have certain audit columns (CreateDate,CreateBy,UpdateDate,UpdateBy) Since they just take up
Is there a way to backup certain tables in a SQL Database? I know
All tables in my database always have an id (autoincrement), at column 0 regardless
I have the following query (all tables are innoDB) INSERT INTO busy_machines(machine) SELECT machine
How can I empty the contents of all tables in my database in phpMyAdmin
All tables in the database have one timestamp column [ float ] followed by
I need to find all the tables in our Oracle database that have attributes
I fetch all tables from a database using tables = Utility.DBConnection.GetSchema(Tables, restrictions); How do
Can we find all tables in the msaccess using sql . as we do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.