automate Click Button on form open

travismp

Registered User.
Local time
Today, 12:57
Joined
Oct 15, 2001
Messages
386
I have a form that opens when the database is opened. There is a button called "btn_GO"

Right now I open the database and the form will open. I then manually click the button. It does everything it needs to. I then close the DB.

Can I tell the form to click the button for me after it opens?

thanks.
 
If the form isn't otherwise necessary, I'd move the code behind the button into a public function in a standard module, and run that function from an autoexec macro (RunCode). Either add this to the function

Application.Quit

or use quit in the macro and you should have a fully automated process.
 
And just in case you do need the form and the button, you can run the button's click event from the form's On Open or On Load event (I'd probably wait for the On Load event) and just call it like:

YourButtonName_Click
 
OK maybe I doing too much then.

query - list all orders placed today
form - nice way to view the orders
I click the button, a VB script I found online will then email each client their info.
I then close the form and then close the database. I do this at the end of the day.


I am trying to get it to just do it on its own without me touching it ever. I am willing to set up the best way possible, but I would need to see examples.
 
OK WOW that was EXCITING!!!

OK, I have never once used a Module but here is what I did. Please let me know if it was right


I copied my VB script from the Form.
I then deleted the form completely.
I then opened a module & Pasted the script. Made a few changes.
I then created a macro

SetWarnings – No
RunCode – EndDayEmail()
Quit

Saved macro as “mac_LAUNCH”
Then made a new form “frm_LAUNCH”
Set “mac_LAUNCH” on the On Load of “frm_LAUNCH”
Then set the form as the form to launch in the start up of options.

Is there a way to launch the macro without needing a form in the start up?

Right now I can set up a scheduled task and it will do everything 100% which is AWESOME. Is it sad to get excited over code??? I am so sad right now! : )
 
AWESOME!!! HAPPY NEW YEARS TO YOU FRIENDS!

That is good to know. I am one happy camper right now. OK, worked great this is a closed case. Now that I am starting to play with some VB I may use the modules a lot more. This could become VERY helpful. Thank you so much guys!
 
Glad that Paul was able to help. He's so good at that you know :)
2-Thumbs_up.png
 

Users who are viewing this thread

Back
Top Bottom