Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search all tables for certain field 2

Status
Not open for further replies.

aliendan

Programmer
Jun 28, 2000
79
US
Hi, I looked in here for a thread on this but couldn't find it anywhere. I need to search through about 200 tables in an Access 2003 database for a field called "evcEventEndDtTm". How can I do this? I appreciate all the help I can get on this. Thank you.

Dan


Dan Rogotzke
Dan_Rogotzke@oxy.com
 
Make a table called "TableFinal" with one field "TableName" (text).

Paste this into a code module

Code:
Function FindTableField()
    Dim T As TableDef
    Dim F As Field
    Dim rs As DAO.Recordset
    Set rs = CurrentDb.OpenRecordset("Select * from TableFinal")

    For Each T In CurrentDb.TableDefs
    
        For Each F In T.Fields
            If F.Name = "evcEventEndDtTm" Then
                rs.AddNew
                rs!TableName = T.Name
                rs.Update
            End If
        Next F
    Next T
    
    Set rs = Nothing
                
    
End Function

Run the code, it'll put the table names with your field in it into the table TableFinal.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Perfect!! Thank you so much. There are some things that I have never used that I know nothing about. :) It is much easier than I tried to make it.

Thanks again,
Dan


Dan Rogotzke
Dan_Rogotzke@oxy.com
 
How are ya aliendan . . .

For something so [blue]Perfect[/blue], why not give [blue]GingerR[/blue] a perfect star (pinky!).

Have a good look at the thread at the bottom of my post, and perhaps it will come to you, why enough of your threads turn out the way they do! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
TheAceMan1, you are absolutely right. I most appreciatively gave her a star. Thank you for bringing this to my attention.

Dan


Dan Rogotzke
Dan_Rogotzke@oxy.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top