Macros in Subforms

K

kwansan

Hi,

I'm having a problem with running a macro in a subform. It works very
smoothly when I open the subform itself separately from the main form.
However, when I run it in the main form, I receive the following error:

Microsoft Access can't find the form referred to in a macro expression.

The macro enables a corresponding field if a check box is marked yes.
Here is the language:

Action: SetValue
Item: [Forms]![Ticket Purchases subform]![Discount Type].[Enabled]
Expression: False

Condition: [Check68]=Yes
Action: SetValue
Item: [Forms]![Ticket Purchases subform]![Discount Type].[Enabled]
Expression: True

Condition: ...
Action: GoToControl
Control Name: Discount Type

The Ticket Purchases subform is embedded in the Contacts form. As I
said before, it works if I open the Ticket Purchases subform
separately, but does not work if attempted within the subform of the
Contacts form. Any help would be greatly appreciated.

Thanks!
D-QUAY
 
S

Steve Schapel

D-Quay,

You ciould refer to is like this...
Item: [Forms]![Contacts]![Ticket Purchases subform]![Discount
Type].[Enabled]

Or, as some would have it...
Item: [Forms]![Contacts]![Ticket Purchases subform].[Form]![Discount
Type].[Enabled]

However, since you seem to be running this macro from an event within
the subform itself, you can just put it like this...
Item: [Discount Type].[Enabled]

If I understand you correctly, do you mean the Discount Price will be
enabled if the Check68 is ticked, and not enabled of it's not. If so,
you can replace the first 2 actions like this...
Condition: <none>
Action: SetValue
Item: [Discount Type].[Enabled]
Expression: =[Check68]
 

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