473,396 Members | 1,886 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.

Search Multiple Tables at once.........?

Hello, I have a Database with lists of Clients in each.
Every year a new tables is created with the naming convention
"CloseYear"
ie close1999, close2000
There are tables from this year back to 1989.

I need to be able to
1) Go to a Search for
2) Enter Criteria -(Client_Last_Name) (Client_First_Name)
(File_Number)
3) Click Find button on form
4) Display Name of Table in which Criteria Matches on a mesage box or
output to a text file

Here is some of my psuedo code
Open Table Close89
search for criteria
If Found then Place table name in memory
Close Table close89
Open Table Close90
Search for criteria
If Found then Place table name in memory
Close Table Close90
loop until all tables searched
Here is a printout of the text file created by the current Database
Program
whe...Client_Last_Name of "Smith" is searched for

Search Criteria used: ==============
Client Last Name: "Smith"
Client First Name: ""
Search Type: "conservative"
current rec# = 471 of 543
Fields searched = 1.CLIENT & contents = Smith, Elijah

table name = 90close.db
================================================== =
current rec# = 472 of 543
Fields searched = 1.CLIENT & contents = Smith, Pamela N.

table name = 90close.db
================================================== =
current rec# = 473 of 543
Fields searched = 1.CLIENT & contents = Smith, Paul D.

table name = 91close.db
================================================== =
current rec# = 562 of 684
Fields searched = 1.CLIENT & contents = Smith, Alicia T.

table name = 91close.db

I need to be able to do this Access itself or VBA
Does anyone know how to Code this?
Nov 13 '05 #1
4 12949
Unfortunately, the table structure you have chosen has complicated the task
for you. Had you simply inserted a date field for date of closing, you'd be
searching a single table. Restructuring in that manner is my suggestion for
a solution to your problem.

Sticking with an improper design will cost you more time and effort over
time than correcting the problem now.

The solution you want, which is to return the _table name_ as though it were
data, is a violation of relational database design principles.

If you simply wanted the record(s), a UNION or UNION ALL Query joining the
various closed-tables might work for you.

Larry Linson
Microsoft Access MVP

"Gobi" <jn******@email.com> wrote in message
news:cf**************************@posting.google.c om...
Hello, I have a Database with lists of Clients in each.
Every year a new tables is created with the naming convention
"CloseYear"
ie close1999, close2000
There are tables from this year back to 1989.

I need to be able to
1) Go to a Search for
2) Enter Criteria -(Client_Last_Name) (Client_First_Name)
(File_Number)
3) Click Find button on form
4) Display Name of Table in which Criteria Matches on a mesage box or
output to a text file

Here is some of my psuedo code
Open Table Close89
search for criteria
If Found then Place table name in memory
Close Table close89
Open Table Close90
Search for criteria
If Found then Place table name in memory
Close Table Close90
loop until all tables searched
Here is a printout of the text file created by the current Database
Program
whe...Client_Last_Name of "Smith" is searched for

Search Criteria used: ==============
Client Last Name: "Smith"
Client First Name: ""
Search Type: "conservative"
current rec# = 471 of 543
Fields searched = 1.CLIENT & contents = Smith, Elijah

table name = 90close.db
================================================== =
current rec# = 472 of 543
Fields searched = 1.CLIENT & contents = Smith, Pamela N.

table name = 90close.db
================================================== =
current rec# = 473 of 543
Fields searched = 1.CLIENT & contents = Smith, Paul D.

table name = 91close.db
================================================== =
current rec# = 562 of 684
Fields searched = 1.CLIENT & contents = Smith, Alicia T.

table name = 91close.db

I need to be able to do this Access itself or VBA
Does anyone know how to Code this?

Nov 13 '05 #2
"Larry Linson" <bo*****@localhost.not> wrote in
news:is*******************@nwrddc03.gnilink.net:
Unfortunately, the table structure you have chosen has complicated
the task for you. Had you simply inserted a date field for date of
closing, you'd be searching a single table. Restructuring in that
manner is my suggestion for a solution to your problem.

Sticking with an improper design will cost you more time and
effort over time than correcting the problem now.

The solution you want, which is to return the _table name_ as
though it were data, is a violation of relational database design
principles.

If you simply wanted the record(s), a UNION or UNION ALL Query
joining the various closed-tables might work for you.


Seems an inadvisable use of the word "joining," since that implies
to me horizontally bringing the tables together, rather then
vertically. A UNION puts records from multiple sources into a single
recordset.

But the real downside of searching a UNION is that the criteria
can't use the indexes in the underlying tables, which will thus be
very, very slow with any large number of records.

Having data for different years in different tables is just a bad
idea all around. Access can handle millions of records, so there
really isn't any justification for separating the things out into
separate tables. And the downside of it is quite clear from the
problem at hand.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #3
"David W. Fenton" wrote
If you simply wanted the record(s), a UNION
or UNION ALL Query joining the various
closed-tables might work for you.
Seems an inadvisable use of the word "joining," since that implies
to me horizontally bringing the tables together, rather then
vertically.


In retrospect, I agree, as "join" has a specific meaning in queries.
A UNION puts records from multiple
sources into a single recordset.
I'd say it "appends" the records returned from each of the UNIONed Queries,
but "append" also has a special meaning. Let's just say it puts all the
records "one after the other".
Having data for different years in different
tables is just a bad idea all around.


Yes, clearly so, and combining them with the addition of an identifying year
(or period) field was my top suggestion.

Larry Linson
Microsoft Access MVP
Nov 13 '05 #4
jn******@email.com (Gobi) wrote in message news:<cf**************************@posting.google. com>...
Hello, I have a Database with lists of Clients in each.
Every year a new tables is created with the naming convention
"CloseYear"
ie close1999, close2000
There are tables from this year back to 1989.

I need to be able to
1) Go to a Search for
2) Enter Criteria -(Client_Last_Name) (Client_First_Name)
(File_Number)
3) Click Find button on form
4) Display Name of Table in which Criteria Matches on a mesage box or
output to a text file


As Larry said, normalize! Create a new table
(Client_Last_Name) (Client_First_Name) (File_Number) (File_Year)

and then append the data in your tables to this one. Then you can do
things the easy way...

SELECT *
FROM tblData
WHERE File_Year BETWEEN 1998 AND 2002;
Nov 13 '05 #5

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

Similar topics

4
by: dave | last post by:
I am wondering if the following can be done. I want to setup a search page that utilizes full text searching in sql2000. I want the user to type in say "where is bill" and have the query search...
1
by: TH | last post by:
I am (still :) working on a recipe database. Now I am trying to figure out how to set it up for an ingredient search. What I want it to be able to do is three things: 1. Search based on just...
3
by: Jan Szymczuk | last post by:
I am trying to create a query that will show me who is phoning who in an organisation from available Telephone Billing information. I am creating a MSAccess 2000 database with a few few tables, two...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
5
by: JP SIngh | last post by:
Hi All This is a complicated one, not for the faint hearted :) :) :) Please help if you can how to achieve this search. We have a freetext search entry box to allow users to search the...
1
by: atl10spro | last post by:
Hello Everyone, I am new to MS Access and although I have created several different databases I lack the VB knowledge to code a search function. I am turning to your expertise for assistance. ...
13
by: Eric IsWhoIAm | last post by:
I have four tables created so far: Courses, Instructors, Courses and Instructors (which shows the Course and Instructor Name fields, but holds their IDs since those are the keys), and Students....
0
by: Skywick | last post by:
Hi I am trying to do a full text search with a column name for the search term. I can do this using LIKE with: SELECT tblContent.ID FROM tblContent INNER JOIN #keywords ON tblContent.words...
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
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.