Wait for form load then have VBA trigger a button.

  • Thread starter Hoardling1 via AccessMonster.com
  • Start date
H

Hoardling1 via AccessMonster.com

Ok, I am having a hard time with this. Access 2007 I have a button that
takes an image of the form and makes it a pdf. Now I need to automate this,
the form loads quite a few queries and displays it. The problem is I keep
getting this error : "This action can't be carried out while processing a
form or report event." So now I have to figure out how to wait for form to
finish loading and then change focus and then trigger button. I've tried all
kinds of different patterns macros, timers, modules etc... Just unable to
figure out how to execute when form is finished loading.

The button works perfectly fine when I go in and manually click it so I know
the internal code is working fine, just the load form and trigger isn't. So
I am looking for any new or fresh ideas on getting this button to trigger
after the form loads.

I know reports are better, but this form also displays variable information
for user to change info if necessary.
 
J

Jeanette Cunningham

Here is one suggestion (untested):

1.Try using a separate form with a button.
Open form with button.
On its current event,
-Put code to open the form with the queries.
-Then a call to DoEvents (just DoEvents on one line).
-Then a call to the code on the form with queries, that creates the pdf.

If that doesn't help, try using WithEvents to tell the form with the button
that the form with the queries has finished loading.
See help for WithEvents.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
H

Hoardling1 via AccessMonster.com

IT WORKED!!!!

Thank You Thank You Thank You!!!!!!!


Jeanette said:
Here is one suggestion (untested):

1.Try using a separate form with a button.
Open form with button.
On its current event,
-Put code to open the form with the queries.
-Then a call to DoEvents (just DoEvents on one line).
-Then a call to the code on the form with queries, that creates the pdf.

If that doesn't help, try using WithEvents to tell the form with the button
that the form with the queries has finished loading.
See help for WithEvents.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
Ok, I am having a hard time with this. Access 2007 I have a button that
takes an image of the form and makes it a pdf. Now I need to automate
[quoted text clipped - 18 lines]
information
for user to change info if necessary.
 

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