Macro Action Fails on Duplicate Record

C

Clddleopard

I have a form with a subform whose visibile property is set to no. I have a
macro that runs when a choice is made in a combo box that sets the visible
property of the subform to yes when the selection=2. The macro sets the
visible property of the subform to no when the selection does not =2. This is
how I have the macro:
Condition: [Appearance]=2
Action:Set Value
Item: [Forms]![Appearance Request
Basic]![OffSiteApp].[Form].[Detail].[Visible]
Expression: True

Condition:...
Action:StopMacro

Condition:(this I left blank)
Action: SetValue
Item:[Forms]![Appearance Request Basic]![OffSiteApp].[Form].[Detail].[Visible]
Expression:False

This macro runs in the AfterUpdate event of the combo box and on the
OnCurrent event of the form.
This works great for what I want it to do, except when I try to make a
duplicate record it says that the action failed. If I hit halt until it goes
away, it makes the duplicate record and shows the subform correctly.
My question is, how do I get it to not show the action failed error? (And it
seems odd to me that it claims the action has failed when it clearly hasn't).
Thanks in advance for your help!
 
S

Steve Schapel

Clddleopard,

First comment to make here, not directly related to your question, is
that the Item expression is more complicated than it needs to be. Is
'OffSiteApp' the name of the subform? If so, I think you only need like
this:
Item: [OffSiteApp].[Visible]

When you say a "duplicate record", do you mean a new record? On the
main form? How are you doing this?... Just going to a new record via
the navigation buttons. or some other type of macro or code? And can
you also please say which action the Action Failed dialog is referring to?
 
C

Clddleopard

Steve,
Thank you!
The simplified Item fixed the whole problem. I don't know why, but it worked.
Thanks for pointing that out!
Steve Schapel said:
Clddleopard,

First comment to make here, not directly related to your question, is
that the Item expression is more complicated than it needs to be. Is
'OffSiteApp' the name of the subform? If so, I think you only need like
this:
Item: [OffSiteApp].[Visible]

When you say a "duplicate record", do you mean a new record? On the
main form? How are you doing this?... Just going to a new record via
the navigation buttons. or some other type of macro or code? And can
you also please say which action the Action Failed dialog is referring to?

--
Steve Schapel, Microsoft Access MVP
I have a form with a subform whose visibile property is set to no. I have a
macro that runs when a choice is made in a combo box that sets the visible
property of the subform to yes when the selection=2. The macro sets the
visible property of the subform to no when the selection does not =2. This is
how I have the macro:
Condition: [Appearance]=2
Action:Set Value
Item: [Forms]![Appearance Request
Basic]![OffSiteApp].[Form].[Detail].[Visible]
Expression: True

Condition:...
Action:StopMacro

Condition:(this I left blank)
Action: SetValue
Item:[Forms]![Appearance Request Basic]![OffSiteApp].[Form].[Detail].[Visible]
Expression:False

This macro runs in the AfterUpdate event of the combo box and on the
OnCurrent event of the form.
This works great for what I want it to do, except when I try to make a
duplicate record it says that the action failed. If I hit halt until it goes
away, it makes the duplicate record and shows the subform correctly.
My question is, how do I get it to not show the action failed error? (And it
seems odd to me that it claims the action has failed when it clearly hasn't).
Thanks in advance for your help!
 

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