Embedded Macros

  • Thread starter Thread starter Summing multiple fields on a form
  • Start date Start date
S

Summing multiple fields on a form

I would like to create a buttonn on my form to:

Save and Add New Record
Close Form
Print current data in form

I hear 2007 has embedded macros but dont know how to use them. Can anyone
please walk me thru creating these macros??? Thx so much
 
Summing,

Once you have the command button on your form, look at the Properties. One
way to get the Properties is to right-click the command button (in design
view of the form), and select Properties from the popup menu.

Scroll down the properties sheet until you find the 'On Click' property.
Click in there to place your cursor in the property box for On CLick, and
then click the ellipsis [...] button to the right. From the opo-up Builder
doalog, select Macro Builder. This will open the macro design window.

After that, I got a bit lost with your description. The basic principle
here is to construct your macro by entering the Actions you need. But I am
not sure of your meaning.

To save a record, you would use the RunCommand action, with SaveRecord
entered for the Command argument. (Note that records are autimatically
saved when a form is closed, or you move to a new record, so explicit saving
is often not necessary).
To Close the form, you would use the Close action, no arguments necessary.
But don't close the form until after your printing.
To print the data, you first of all need to have created a report for the
presentation of the data. And then, in the Criteria of the query that the
report is based on, you refer to the key field of the current record on the
form, using syntax the equivalent of:
[Forms]![NameOfYourFOrm]![NameOfKeyField]
Once you have that set up, then use the OpenReport action in your macro to
print the report. You will need to enter the name of the report in the
arguments for the OpenReport action.

When you have finished designing the macro, close it, say Yes to the prompt
to save it, and then you will see [Embedded Macro] in the On Click property
of the command button.
 
Thanks for your help Steve. After following your direction, I see why my
post may have been confusing. I guess that happens when one doesnt know what
they are doing. Thanks Again, it worked and I better understand the
procedure.

Steve Schapel said:
Summing,

Once you have the command button on your form, look at the Properties. One
way to get the Properties is to right-click the command button (in design
view of the form), and select Properties from the popup menu.

Scroll down the properties sheet until you find the 'On Click' property.
Click in there to place your cursor in the property box for On CLick, and
then click the ellipsis [...] button to the right. From the opo-up Builder
doalog, select Macro Builder. This will open the macro design window.

After that, I got a bit lost with your description. The basic principle
here is to construct your macro by entering the Actions you need. But I am
not sure of your meaning.

To save a record, you would use the RunCommand action, with SaveRecord
entered for the Command argument. (Note that records are autimatically
saved when a form is closed, or you move to a new record, so explicit saving
is often not necessary).
To Close the form, you would use the Close action, no arguments necessary.
But don't close the form until after your printing.
To print the data, you first of all need to have created a report for the
presentation of the data. And then, in the Criteria of the query that the
report is based on, you refer to the key field of the current record on the
form, using syntax the equivalent of:
[Forms]![NameOfYourFOrm]![NameOfKeyField]
Once you have that set up, then use the OpenReport action in your macro to
print the report. You will need to enter the name of the report in the
arguments for the OpenReport action.

When you have finished designing the macro, close it, say Yes to the prompt
to save it, and then you will see [Embedded Macro] in the On Click property
of the command button.

--
Steve Schapel, Microsoft Access MVP


"Summing multiple fields on a form"
I would like to create a buttonn on my form to:

Save and Add New Record
Close Form
Print current data in form

I hear 2007 has embedded macros but dont know how to use them. Can anyone
please walk me thru creating these macros??? Thx so much
.
 
Back
Top