Run queries and export into excel

M

moloff

Please bear with me. I am well versed in Excel VBA, but not at all familiar
with Access. Last year I took over a piece of equipment that collects data
from a process. The person who set up the data collection scheme has since
moved on and left the company. He set up a couple of queries that are
accessed from a form where start and end time are requested. Following that
you can press different buttons to pull the data from that experiment.
Following the query, the user is asked to go to Tools and Analyze with Excel
to get the data into excel. For my work, I do two different queries and add
them to one excel spreadsheet followed by some excel macros. I can do this
easily, however, I would much prefer to have a macro that runs two queries,
and add them both to one Excel work book but two different sheets. Can
anyone help me?

Thanks!

These are my queries:

PARAMETERS Forms![Data Extract Form]!Start DateTime, Forms![Data Extract Form]
![End] DateTime;
TRANSFORM Avg(Basic.Val) AS [The Value]
SELECT Basic.DateAndTime
FROM Basic
WHERE (((Basic.TagName) Like "alarms\e_stop_pressed" Or (Basic.TagName) Like
"mmi_temps\*") And ((Basic.DateAndTime) Between Forms![Data Extract Form]!
Start And Forms![Data Extract Form]!End))
GROUP BY Basic.DateAndTime
PIVOT Basic.TagName;


PARAMETERS Forms![Data Extract Form]!Start DateTime, Forms![Data Extract Form]
![End] DateTime;
TRANSFORM Avg(Basic.Val) AS [The Value]
SELECT Basic.DateAndTime
FROM Basic
WHERE (((Basic.TagName) Like "buttons\*" Or (Basic.TagName) Like "unit\
cycle_step" Or (Basic.TagName) Like "unit\mmi_v*") And ((Basic.DateAndTime)
Between Forms![Data Extract Form]!Start And Forms![Data Extract Form]!End))
GROUP BY Basic.DateAndTime
PIVOT Basic.TagName;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top