append query (select * from someTable, then list all tables..) ?

  • Thread starter Thread starter imin
  • Start date Start date
I

imin

Guest
hi

is it possible, for any reason, to append another sql query after one sql query?
for example, the first one is "select name from bla bla where name=something" and we just add another query at the end of the query to make something like
"select name from bla bla where name=something and
then show table from this database"

btw i'm using asp to call all these queries..

any help is greatly appreciated..thanks :)
 
imin,

It sounds like you want a UNION query. Both queries will have to be
similar in number of columns & datatypes.

You can get further info from Access Help or use the Search Facility
here.

Wayne
 
thanks a lot for replying...yup, i've thought about the union query. But I don't think I could use the statement like "show tables" using the union query, right? What I really want to do is like, after we have executed the "select bla bla...", i want to instantly execute the command like "show tables" to list all the tables in the database (for administrative purposes), hence I need (if there's any) some way to append this kind of command to existing sql query.

Erm.. or is it there's no way to create a command that may function like this ?:
"select name from bla bla where name=something and then show table from this database"

One of the reason i want to do this is because I'd like to avoid too many lines inside my asp code.
 
imin,

You can place a combo-box named "cboWhatTable" on your form.
Set its RowSource to:

Code:
Select Name
From   MSysObjects
Where  Type = 1
Order By Name

In the AfterUpdate Of the Combo, you "adjust" the reusable
query to display the selected table:

Code:
Dim qdf As DAO.QueryDef
'
' Reopen a reusable query and set its RecordSource to the 
' Name of the selected table
'
Set qdf = CurrentDb.QueryDefs("SomeReUsableQuery")
qdf.SQL = "Select * From " & Me.cboWhatTable & ";"
qdf.Close

DoCmd.OpenQuery "SomeReUsableQuery"

Hope that gets you started.

Wayne
 
hmm..it doesn't seem very complicated.. i'll try it
thanks a lot for helping :)
 

Users who are viewing this thread

Back
Top Bottom