Assign a Module to a Form Button

D

Dave Couch

I have created a module to send an email whne a form is completed. I wnat a
command button to click and execute the module. I can't find where I can
select a module to run at the "on-click" property. How do I do this?
 
F

fredg

I have created a module to send an email whne a form is completed. I wnat a
command button to click and execute the module. I can't find where I can
select a module to run at the "on-click" property. How do I do this?

A module is just the place that you place your code.
What is the name of the sub procedure you placed within the module?
Let's say it's called
Sub SendEmail()

Using code from a command button Click event on your form, code:

SendEmail
 
M

mcescher

I have created a module to send an email whne a form is completed.  I wnat a
command button to click and execute the module.  I can't find where I can
select a module to run at the "on-click" property.  How do I do this?

In the design mode of the form, open the properties for the command
button. Scroll part way down to the OnClick event and click the
elipses (three dots) Select "Code Builder", and call your code from
there.

Hope this helps,
Chris M.
 

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