473,396 Members | 2,018 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,396 software developers and data experts.

Code to Search Tables Collection for a Specific String

Using MS Access 2003 I am looking for a function that will search the
entire Tables Collection for a specific string in text or memo fields.
For example if I enter "widget" it interrogates the entire tables
collection and returns the table name and column name where the word is
found, otherwise returns "Not Found"

Any help with this greatly appreciated.

RBollinger

Nov 13 '05 #1
1 5250
robboll wrote:
Using MS Access 2003 I am looking for a function that will search the
entire Tables Collection for a specific string in text or memo fields.
For example if I enter "widget" it interrogates the entire tables
collection and returns the table name and column name where the word is
found, otherwise returns "Not Found"

Any help with this greatly appreciated.

RBollinger


I've created code to search for text fields. I don't think you can use
FindFirst with memos. You may have to create a SQL string and run a
query for memo fields.

Sub ScanFieldsForString()

Dim dbs As Database
Dim fld As Field
Dim tdf As TableDef
Dim rst As DAO.Recordset
Dim strFind As String

Set dbs = CurrentDb

With dbs
For Each tdf In dbs.TableDefs
If Left(tdf.name, 4) <> "Msys" Then
Set rst = CurrentDb.OpenRecordset(tdf.name, dbOpenSnapshot)
For Each fld In tdf.Fields
If fld.Type = dbTex Then
strFind = "[" & fld.name & "] Like
""*SearchString*"""
rst.FindFirst strFind
If Not rst.NoMatch Then MsgBox tdf.name & " " &
fld.name
End If
Next fld
rst.Close
Set rst = Nothing
End If
Next tdf
End With
dbs.Close
Set dbs = Nothing
MsgBox "Done"
End Sub
Nov 13 '05 #2

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

Similar topics

22
by: Martin MOKREJ© | last post by:
Hi, I'm looking for some easy way to do something like include in c or PHP. Imagine I would like to have: cat somefile.py a = 222 b = 111 c = 9
242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
8
by: Steve Jorgensen | last post by:
Hi folks, I'm posting this message because it's an issue I come up against relatively often, but I can't find any writings on the subject, and I haven't been able to figure out even what key...
1
by: DD | last post by:
I have the following code and my question is Do i use a Autoexec to fire this ? As: fGetLinkedTables("ODBC") Or how do i ?? do i replace the above as fGetLinkedTables("test_be") Or ???
8
by: Steph | last post by:
Hi. I'm very new to MS Access and have been presented with an Access database of contacts by my employer. I am trying to redesign the main form of the database so that a button entitled...
4
by: RoadRunner | last post by:
Hi, I have a question. I am asked to produce a global search of a given corporate name, in more that one database. Each database has different table names and different field names in the tables....
53
by: Hexman | last post by:
Hello All, I'd like your comments on the code below. The sub does exactly what I want it to do but I don't feel that it is solid as all. It seems like I'm using some VB6 code, .Net2003 code,...
3
by: peterhall | last post by:
In VBA an Access module has a find method - works perfectly to find a string inside a module. i'm working in A97 (legacy) systems (large ones) and want to write code that searches all modules so that...
0
by: dprjessie | last post by:
Hello, I am a Web programmer and I'm working on my first desktop application as a favor for a friend. I'm sure I have a stupid error here, but there is no error being thrown so I can't figure out...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.