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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dialog PopUp from Access 2000 - Query prompt for table prior to ...?

Status
Not open for further replies.

Lynux

MIS
Aug 3, 2001
33
US
I am converting a very old database (a few hundred .dbf files) to Access and have run into a situation where I have 80 tables each representing a different districts data ((all of which have the same number of fields - field names - and the tables are named after the districts ))
Instead of merging all of these tables is it possible to structure a query to prompt the user to enter a district which then would triger Access to to go to that table (tables are named after the districts) and display the field specified in the query?


Here is the SQL I have:
SELECT [ORD00000].[ITEM_NO], [ORD00000].[CAT_TYPE], [ORD00000].[PRE_EST], [ORD00000].[FIN_ORD], [ORD00000].[LST_YR_TOT], [ORD00000].[TOT_ORD]
FROM ORD00000;

What I need is:
SELECT [USER-PROMPTED-FOR-DISTRICT?].[ITEM_NO], [USER-PROMPTED-FOR-DISTRICT?].[CAT_TYPE], [USER-PROMPTED-FOR-DISTRICT?].[PRE_EST], [USER-PROMPTED-FOR-DISTRICT?].[FIN_ORD], [USER-PROMPTED-FOR-DISTRICT?].[LST_YR_TOT], [USER-PROMPTED-FOR-DISTRICT?].[TOT_ORD]
FROM USER-PROMPTED-FOR-DISTRICT?;

Is this even possible (using a Query or Report procedure would be fine.. I am just trying to keep from manually merging all of these tables (plus adding a district field)?

Thanks in Advance ! ! !
=================================
Imagination is more important than knowledge.
(A.E.)
 
Let's assume you have a form with a text box called txtDistrict

Command SomeButton On_Click()
Dim strSQL
dim qdef as querydef
Dim dbs as database
Set dbs = currentdb()
Set qdef = dbs.querydefs("YourQueryName")

strSQl = "Select [Field1],[field2], etc etc From"
strSQl = strSQl & Me.txtDistrict

With qdef
.sql = strSQL
End With

Docmd.OpenQuery("YourQueryName")

It would be easier to merge the tables and add a district field and search on that. Unless, you've got like 100,000+ records...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top