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

Question on make table query 1

Status
Not open for further replies.
Joined
Feb 4, 2009
Messages
137
Location
US
Hello, please help with make table query.

I have 1 main table and 3 other tables linked with UserID on one – to – many.

I tried to make table query on 4 different tables within a certain time frame based on the date ([DateUsed]) on the main table. (My parameter in criteria in each query would be the same and like this “Between [Enter Begin Date] and [Enter End Date]”

I have no problem when run make table query on each single query. However, I would like to know is it possible to run all 4 queries at the same time and only enter the parameter only one time, instead of 4 times?
Thanks
 
create A for with 2 text boxes and a command button

text boxes
BeginDate And EndDate

Set the parameters in all 4 queries as
between form!formname!BeginDate And form!formname!EndDate

and in the on click of the command button
Code:
with docmd
 .openquery "query1"
 .openquery "query2"
 .openquery "query3"
 .openquery "query4"

end with
 
Thanks pwise
It works like charm...Again, thanks alots
 
Now I have a question similar to this one, but it’s gona be backward.

I have 2 databases named “A.mdb” and “B.mdb”

The database “A.mdb” is a blank database and only has one form named “frmMakeTable” with 2 text boxes named “BeginDate” and “EndDate” and a button named “cmdRunMakeTableQuery”.

The database “B.mdb” is SQL backend and access font end has ODBC instatlled on PC named “Food”.
Now I would like to make table queries into database A from those queries from database B based on the “BeginDate” and “EndDate” on the form from database A

Please help, I’m very appreciated. Thanks.
 
The make table quries are in a.mdb or b.mdb?

also what is the full path of both databases?

 
The make table queries are in A.
A: K:\Custom\ENV\Food\A.mdb
B: K:\Custom\ENV\Food-HDH\ACB\B.mdb

Thanks
 
change make table quries Sql to

Code:
SELECT * INTO [I]NewAccessTableName[/i]
FROM [I]SqlTableNsme[/I] IN '' [ODBC;DRIVER=SQL Server;SERVER=[I]ServerThatSqlIsInstalledOn][/I];
 
Could you please be more specific? I still don't get it.
Thanks
 
I tried everything but no luck, if anyone knows please help. I'm very appreciated. Thanks.
 
what is the Sql of ypur quries
 
sSQL = "SELECT * INTO myLocalTable FROM mySQLtable IN '' [ODBC;DRIVER=SQL Server;SERVER=PH-SQL]"
or
sSQL = "SELECT * INTO myLocalTable FROM mySQLtable IN '' [ODBC;DRIVER=SQL Server;SERVER=PH-SQL;]"
or either
sSQL = "SELECT * INTO myLocalTable FROM [ODBC;DRIVER=SQL Server;SERVER=PH-SQL].[mySQLtable]"

I even tried this
sSQL = "SELECT * INTO myLocalTable FROM [ODBC;Driver={SQL Server};SERVER=PH-SQL;DATABASE=Food].[mySQLTable];
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top