Does 'has module' need to be set to true on forms to run macros?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that has required fields set and two command buttoms that
should run macro's.
When the 'has module' property is set to TRUE for the form, the macros run,
but the required fields can be left blank and the form be closed out.
When the 'has module' property is set to FALSE for the form, the macros do
not run, but the required fields have to filled in.

Any suggestions on how to make the required fields required and the command
buttons run the macros?
 
I have a form that has required fields set and two command buttoms that
should run macro's.
When the 'has module' property is set to TRUE for the form, the macros run,
but the required fields can be left blank and the form be closed out.
When the 'has module' property is set to FALSE for the form, the macros do
not run, but the required fields have to filled in.

Any suggestions on how to make the required fields required and the command
buttons run the macros?

The answer to you initial question is "No", the Has Module setting
does not have to be set to True for you to run Macros.

As for the issue about changing that property and that making a change
to the required fields, AFIK there is no relation between that setting
and required fields. When you say "required fields" I am assuming
that you have set the "Required" flag to true in you table for those
fields.

In my testing using Access 2003, there is no change in the requirement
for a field (when set in the table) when the "Has Module" property is
set either way.

There may be something else causing this issue.

HTH

Mr B
 
How are you requiring the fields be filled in?
If you are using any VBA code for this purpose, then Has Module will be
required.
If you set Has Module to Yes, then the validation at the form level is
working because it is using VBA. If it causes the macros not to execute, the
the macros have not been applied correctly.
 
How are you requiring the fields be filled in?
If you are using any VBA code for this purpose, then Has Module will be
required.
If you set Has Module to Yes, then the validation at the form level is
working because it is using VBA. If it causes the macros not to execute, the
the macros have not been applied correctly.
--
Dave Hargis, Microsoft Access MVP






- Show quoted text -

Dave,

If they set the Has Module to No then the code would be deleted. So
I'm confused as to what changing the setting for Has Module has to do
with not requiring a required field.

Mr B
 
That is, of course, true. I am trying to get more detail to determine what
the problem is.
 
"the Has Module setting does not have to be set to True for you to run Macros.
"

This is true, but it has to set to True in order for the Macros to be run by
*clicking on a command button*! Set to No there is no code behind the command
button, including code to run a Macro!

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
Not true.
If you put the name of a macro directly in the Properties Dialog Event box
of a control on a form with Has Module set to No, it will execute.
Try it.
Create a new form.
set the Has Module to No.
put a command button on the form.
create a macro that just displays a message box.
open the properties dialog for the command button.
Select the Events tab.
Type the name of the macro in the click event text box.
Switch to Form view.
click the button.
 
I changed my command buttons to run macros and both my required fields and
command buttons function correclty with or without the 'Has module' property
set to 'yes'.

I stated in my original question that the macros were not working, but I was
mistaken because there was actually code behind the command buttons, not
macros-sorry, I am self taught and learning as I read.

If I create the command button using the options provided under catagories
and actions and do not run a macro but select one of the predefined
functions, with the 'Has module' set to yes, the command buttons work, but
the required fields do not, and with the 'Has module' set to no, the command
buttons do not work, but the required fields do. This is what I stated in my
original question and still holds true.

The required fields are defined in my table where the 'Required' property is
set to 'Yes'
 
Back
Top