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

Function Based Make Table Query? 1

Status
Not open for further replies.

deepgrewal22

Instructor
May 2, 2005
108
0
0
Is there any way to have a Make Table Query create tables based on the Function that was passed to it?

For example:
(1) Function() = California
(2) Make Table Query ("MTQ1") recieves "California" as the value and creates table of only records with "California" as an attribute.
(3) Make Table Query names this table "California Results".
(4) Function changes values and now: Function() = Florida
(5) Make Table Query ("MTQ1") recieves "Florida" as the value and creates table of only records with "Florida" as an attribute.
(6) Make Table Query names this table "Florida Results"

I am assuming this would be done in the SQL Design View of the query, I just don't know the syntax.


Deep Grewal
Don't say the M word (Microsoft); you sound ignorant.
 
I would do this through code

Code:
Dim strQry as string
strQry = "SELECT myTbl.field1, myTbl.Field2..., INTO [" & Function() & " Results] FROM myTbl
WHERE (((myTbl.FieldX)='" & Function() *"'));"

docmd.runSql strQry

I hope this helpss
 
Thanx Captain Phan!

Deep Grewal
Don't say the M word (Microsoft); you sound ignorant.
 
deepgrewal,

Can you post your code so that we may see how your function works with captphan's code.

TIA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top