Activate a button from another form

J

Jeff

Hi All,

I have a form that is opened from a button, in the form I have a
subformcontrol that holds a table view of an update query. On the form,
there is a button to merge the information to a Word document.

For some reason, the Word document, when merged, does not show the
information from the update query (only from the mainform), even though
the information has been updated into the table.

If I close the Form and then open it again, the whole Word document is
merged perfectly. But, I just want to open the form once, not twice.
Can't figure it out!

Anyway, one workaround would be to close the form and open it again in
one operation. I can close the document with a button, I just want the
same button to activate the button that originally opened the form.

How do I run the button from another form, as if it was being clicked?

Any help greatly appreciated.
 
T

TC

Well, that's a bit like saying: "There's smoke coming out of my
engine. How can I cover it up, so I don't have to see it?" :)

In other words, I think you'd be better-off to find out why your
mailmerge isn't working how you think it should. If you posted some
more details of what you are doing, maybe someone else could help.

As for clicking a button in another form: if you absolutely positively
have to do that, here is how the code in a form 'A', can click the
button named cmdBLAH, in another currently open form, form B:

forms("B").cmdBLAH_Click

To get that to work, you'd have to change the "sub" line of the cmdBLAH
Click event, in fom B, from this:

sub cmdBLAH_Click()

to this:

PUBLIC sub cmdBLAH_Click()

HTH,
TC (MVP Access)
http://tc2.atspace.com
 
S

strive4peace

Hi Jeff,

rather than going through the gymnastics of running this
from another form, let us try to get the button to work on
the form you currently have.

Once you run your update query, do this:

currentdb.tabledefs.refresh
DoEvents

if that doesn't solve the problem, we will explore other options

Warm Regards,
Crystal
MVP Microsoft Access

remote programming and training
strive4peace2006 at yahoo.com
*
Have an awesome day ;)
 

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