Need focus on query first, then on Form when query is closed

G

Guest

I am using Microsoft Office Prof Ed 2003, SP2 for my access dbs and I wasn't
sure if this is a Form Coding question or a Macro question. I am having
problems in coding/macro usage on a cmdbutton: I am using the frmList of
Reports as Start Up Form. There are several cmdbuttons on this from, linking
to several Macros which in turn open several reports. One of my cmdbuttons
when pressed via Macro, opens [qryRequirement Status Comp by ETID], which
requires [Enter ETID] as a parameter. I want the user to be able to copy and
paste the results of that query directly into his own Excel directory, so he
can then manipulate the data and display it depending on that day's tasking.
The macro name: mcrfrmLOR4RR.LOR4 RRSRCR: On Click; has the Action:
OpenQuery: qryRequirement Status Comp by ETID.

As I enter the [ETID]; the macro opens the query in the background, leaving
the frmList of Reports in front. If I press the upper right close button on
the form, I am able to copy and paste the results of the query. Upon using
the upper right close button on the query, the db is closed. If I add the
2nd part of the Macro: Close: frmList of Reports, when the cmdbutton is
pressed, the frmList of Reports does close automatically, the query is
displayed and again the db is closed when I press the upper right close
button on the query results. Is there a way to place the frmList of Reports
in the background while the query is open, and when I close the query, the
frmList of Reports is the main focus; displayed in front. Someone mentioned
that coding would fix the problem, however, I’m not sure what the wording and
placement of the code would be since I don’t use VBA. Any suggestion would
be appreciative.
 
H

Hunter57

I am using Microsoft Office Prof Ed 2003, SP2 for my access dbs and I wasn't
sure if this is a Form Coding question or a Macro question. I am having
problems in coding/macro usage on a cmdbutton: I am using the frmList of
Reports as Start Up Form. There are several cmdbuttons on this from, linking
to several Macros which in turn open several reports. One of my cmdbuttons
when pressed via Macro, opens [qryRequirement Status Comp by ETID], which
requires [Enter ETID] as a parameter. I want the user to be able to copy and
paste the results of that query directly into his own Excel directory, so he
can then manipulate the data and display it depending on that day's tasking.
The macro name: mcrfrmLOR4RR.LOR4 RRSRCR: On Click; has the Action:
OpenQuery: qryRequirement Status Comp by ETID.

As I enter the [ETID]; the macro opens the query in the background, leaving
the frmList of Reports in front. If I press the upper right close button on
the form, I am able to copy and paste the results of the query. Upon using
the upper right close button on the query, the db is closed. If I add the
2nd part of the Macro: Close: frmList of Reports, when the cmdbutton is
pressed, the frmList of Reports does close automatically, the query is
displayed and again the db is closed when I press the upper right close
button on the query results. Is there a way to place the frmList of Reports
in the background while the query is open, and when I close the query, the
frmList of Reports is the main focus; displayed in front. Someone mentioned
that coding would fix the problem, however, I'm not sure what the wording and
placement of the code would be since I don't use VBA. Any suggestion would
be appreciative.

It would greatly help if you could post your code or macro here so
someone can understand better how to help you.

Regards,
Hunter57
http://churchmanagementsoftware.googlepages.com/home
 
G

Guest

I believe I placed the contents of the macro in my first paragraph as: The
macro name: mcrfrmLOR4RR.LOR4 RRSRCR: On Click; has the Action: OpenQuery:
qryRequirement Status Comp by ETID. I don't have any codes; this is what I
was inquiring about! Curtis...


Hunter57 said:
I am using Microsoft Office Prof Ed 2003, SP2 for my access dbs and I wasn't
sure if this is a Form Coding question or a Macro question. I am having
problems in coding/macro usage on a cmdbutton: I am using the frmList of
Reports as Start Up Form. There are several cmdbuttons on this from, linking
to several Macros which in turn open several reports. One of my cmdbuttons
when pressed via Macro, opens [qryRequirement Status Comp by ETID], which
requires [Enter ETID] as a parameter. I want the user to be able to copy and
paste the results of that query directly into his own Excel directory, so he
can then manipulate the data and display it depending on that day's tasking.
The macro name: mcrfrmLOR4RR.LOR4 RRSRCR: On Click; has the Action:
OpenQuery: qryRequirement Status Comp by ETID.

As I enter the [ETID]; the macro opens the query in the background, leaving
the frmList of Reports in front. If I press the upper right close button on
the form, I am able to copy and paste the results of the query. Upon using
the upper right close button on the query, the db is closed. If I add the
2nd part of the Macro: Close: frmList of Reports, when the cmdbutton is
pressed, the frmList of Reports does close automatically, the query is
displayed and again the db is closed when I press the upper right close
button on the query results. Is there a way to place the frmList of Reports
in the background while the query is open, and when I close the query, the
frmList of Reports is the main focus; displayed in front. Someone mentioned
that coding would fix the problem, however, I'm not sure what the wording and
placement of the code would be since I don't use VBA. Any suggestion would
be appreciative.

It would greatly help if you could post your code or macro here so
someone can understand better how to help you.

Regards,
Hunter57
http://churchmanagementsoftware.googlepages.com/home
 
H

Hunter57

I believe I placed the contents of the macro in my first paragraph as: The
macro name: mcrfrmLOR4RR.LOR4 RRSRCR: On Click; has the Action: OpenQuery:
qryRequirement Status Comp by ETID. I don't have any codes; this is what I
was inquiring about! Curtis...



Hunter57 said:
I am using Microsoft Office Prof Ed 2003, SP2 for my access dbs and I wasn't
sure if this is a Form Coding question or a Macro question. I am having
problems in coding/macro usage on a cmdbutton: I am using the frmList of
Reports as Start Up Form. There are several cmdbuttons on this from, linking
to several Macros which in turn open several reports. One of my cmdbuttons
when pressed via Macro, opens [qryRequirement Status Comp by ETID], which
requires [Enter ETID] as a parameter. I want the user to be able to copy and
paste the results of that query directly into his own Excel directory, so he
can then manipulate the data and display it depending on that day's tasking.
The macro name: mcrfrmLOR4RR.LOR4 RRSRCR: On Click; has the Action:
OpenQuery: qryRequirement Status Comp by ETID.
As I enter the [ETID]; the macro opens the query in the background, leaving
the frmList of Reports in front. If I press the upper right close button on
the form, I am able to copy and paste the results of the query. Upon using
the upper right close button on the query, the db is closed. If I add the
2nd part of the Macro: Close: frmList of Reports, when the cmdbutton is
pressed, the frmList of Reports does close automatically, the query is
displayed and again the db is closed when I press the upper right close
button on the query results. Is there a way to place the frmList of Reports
in the background while the query is open, and when I close the query, the
frmList of Reports is the main focus; displayed in front. Someone mentioned
that coding would fix the problem, however, I'm not sure what the wording and
placement of the code would be since I don't use VBA. Any suggestion would
be appreciative.
It would greatly help if you could post your code or macro here so
someone can understand better how to help you.

- Show quoted text -

Sorry about that. I rarely use macros so I did not catch what you
were saying.

Hunter57
 
J

John W. Vinson

I am using Microsoft Office Prof Ed 2003, SP2 for my access dbs and I wasn't
sure if this is a Form Coding question or a Macro question. I am having
problems in coding/macro usage on a cmdbutton: I am using the frmList of
Reports as Start Up Form. There are several cmdbuttons on this from, linking
to several Macros which in turn open several reports. One of my cmdbuttons
when pressed via Macro, opens [qryRequirement Status Comp by ETID], which
requires [Enter ETID] as a parameter. I want the user to be able to copy and
paste the results of that query directly into his own Excel directory, so he
can then manipulate the data and display it depending on that day's tasking.
The macro name: mcrfrmLOR4RR.LOR4 RRSRCR: On Click; has the Action:
OpenQuery: qryRequirement Status Comp by ETID.

Don't "open" the query at all, I'd suggest! Take a look at the online help for
TransferSpreadsheet; you can directly export the query to Excel without the
user having to see the query datasheet, nor to copy and paste it.

I'd do it from VBA code (more flexible, and supporting error trapping) rather
than a macro, but I'm sure it can be done from either.

John W. Vinson [MVP]
 
G

Guest

Mr Vinson: Thank you very much for your suggestion. I used the
TransferSpreadsheet action in my macro with the assistance of the link below
and it works just fine!. Thanks for your professionalism.

http://support.microsoft.com/default.aspx?scid=kb;en-us;124514&Product=acc

curtis....

John W. Vinson said:
I am using Microsoft Office Prof Ed 2003, SP2 for my access dbs and I wasn't
sure if this is a Form Coding question or a Macro question. I am having
problems in coding/macro usage on a cmdbutton: I am using the frmList of
Reports as Start Up Form. There are several cmdbuttons on this from, linking
to several Macros which in turn open several reports. One of my cmdbuttons
when pressed via Macro, opens [qryRequirement Status Comp by ETID], which
requires [Enter ETID] as a parameter. I want the user to be able to copy and
paste the results of that query directly into his own Excel directory, so he
can then manipulate the data and display it depending on that day's tasking.
The macro name: mcrfrmLOR4RR.LOR4 RRSRCR: On Click; has the Action:
OpenQuery: qryRequirement Status Comp by ETID.

Don't "open" the query at all, I'd suggest! Take a look at the online help for
TransferSpreadsheet; you can directly export the query to Excel without the
user having to see the query datasheet, nor to copy and paste it.

I'd do it from VBA code (more flexible, and supporting error trapping) rather
than a macro, but I'm sure it can be done from either.

John W. Vinson [MVP]
 

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