Conditional Macro Help?

W

What-a-Tool

Have a macro named mcrClose.
Within is a macro named mcrCloseoptions.
mcrCloseOptions has conditions relating to option group selection and is run
on a button click:

[grpExit] = 1
[grpExit] = 2
[grpExit] = 3

As of now, all I have is a MsgBox function beside each condition to tell me
if its working.
If I select #1, #1 and #2 run - same if I select #2
If I select #3, all three run.

Can anyone please tell me what I'm doing wrong here?

Thanks in advance


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 
K

Ken Snell

Offhand, I'd look first at your option group to be sure that the values of
each option control within it are what you expect. Is grpExit the name of
the frame that holds the options?

If the frame is named grpExit and each option control within it has the
correct data value assigned to it, then what you're describing doesn't seem
possible. On which event are you running mcrCloseoptions?
 
W

What-a-Tool

Correct on all counts -

Running on AfterUpdate Event

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Ken Snell said:
Offhand, I'd look first at your option group to be sure that the values of
each option control within it are what you expect. Is grpExit the name of
the frame that holds the options?

If the frame is named grpExit and each option control within it has the
correct data value assigned to it, then what you're describing doesn't seem
possible. On which event are you running mcrCloseoptions?

--
Ken Snell
<MS ACCESS MVP>

What-a-Tool said:
Have a macro named mcrClose.
Within is a macro named mcrCloseoptions.
mcrCloseOptions has conditions relating to option group selection and is run
on a button click:

[grpExit] = 1
[grpExit] = 2
[grpExit] = 3

As of now, all I have is a MsgBox function beside each condition to tell me
if its working.
If I select #1, #1 and #2 run - same if I select #2
If I select #3, all three run.

Can anyone please tell me what I'm doing wrong here?

Thanks in advance


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 
W

What-a-Tool

Actually ran on the click event of a button first.

Performs the same on the AfterUpdate and also Click event of the option group.

Macro Name Condition Action

mcrCloseOptions [grpExit]=1 MsgBox
[grpExit]=2 MsgBox
[grpExit]=3 MsgBox

If there is nothing wrong with my sytax or methods, I must be doing something stupid somewhere else - Thanks



--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

What-a-Tool said:
Correct on all counts -

Running on AfterUpdate Event

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Ken Snell said:
Offhand, I'd look first at your option group to be sure that the values of
each option control within it are what you expect. Is grpExit the name of
the frame that holds the options?

If the frame is named grpExit and each option control within it has the
correct data value assigned to it, then what you're describing doesn't seem
possible. On which event are you running mcrCloseoptions?

--
Ken Snell
<MS ACCESS MVP>

What-a-Tool said:
Have a macro named mcrClose.
Within is a macro named mcrCloseoptions.
mcrCloseOptions has conditions relating to option group selection and is run
on a button click:

[grpExit] = 1
[grpExit] = 2
[grpExit] = 3

As of now, all I have is a MsgBox function beside each condition to tell me
if its working.
If I select #1, #1 and #2 run - same if I select #2
If I select #3, all three run.

Can anyone please tell me what I'm doing wrong here?

Thanks in advance


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 
K

Ken Snell

If you can zip up a small sample of your database, email it to me (delete
this is not real from my email address) and I'll take a look at what you
have.

--
Ken Snell
<MS ACCESS MVP>

Actually ran on the click event of a button first.

Performs the same on the AfterUpdate and also Click event of the option
group.

Macro Name Condition Action

mcrCloseOptions [grpExit]=1 MsgBox
[grpExit]=2 MsgBox
[grpExit]=3 MsgBox

If there is nothing wrong with my sytax or methods, I must be doing
something stupid somewhere else - Thanks



--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

What-a-Tool said:
Correct on all counts -

Running on AfterUpdate Event

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Ken Snell said:
Offhand, I'd look first at your option group to be sure that the values of
each option control within it are what you expect. Is grpExit the name of
the frame that holds the options?

If the frame is named grpExit and each option control within it has the
correct data value assigned to it, then what you're describing doesn't seem
possible. On which event are you running mcrCloseoptions?

--
Ken Snell
<MS ACCESS MVP>

Have a macro named mcrClose.
Within is a macro named mcrCloseoptions.
mcrCloseOptions has conditions relating to option group selection and
is
run
on a button click:

[grpExit] = 1
[grpExit] = 2
[grpExit] = 3

As of now, all I have is a MsgBox function beside each condition to
tell
me
if its working.
If I select #1, #1 and #2 run - same if I select #2
If I select #3, all three run.

Can anyone please tell me what I'm doing wrong here?

Thanks in advance


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 
W

What-a-Tool

Thanks for the generous offer - I got it working though

Have a named macro with my conditions - if that condition is true it runs my
called sub macro. This method works.

If I try to put multiple method calls under the condition itself, it just
runs everything, ignoring my conditions for some reason.

Like I said, I'm sure I was doing something stupid that I just didn't have
the experience to see.

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Ken Snell said:
If you can zip up a small sample of your database, email it to me (delete
this is not real from my email address) and I'll take a look at what you
have.

--
Ken Snell
<MS ACCESS MVP>

Actually ran on the click event of a button first.

Performs the same on the AfterUpdate and also Click event of the option
group.

Macro Name Condition Action

mcrCloseOptions [grpExit]=1 MsgBox
[grpExit]=2 MsgBox
[grpExit]=3 MsgBox

If there is nothing wrong with my sytax or methods, I must be doing
something stupid somewhere else - Thanks



--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

What-a-Tool said:
Correct on all counts -

Running on AfterUpdate Event

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
values
and
is
run
on a button click:

[grpExit] = 1
[grpExit] = 2
[grpExit] = 3

As of now, all I have is a MsgBox function beside each condition to tell
me
if its working.
If I select #1, #1 and #2 run - same if I select #2
If I select #3, all three run.

Can anyone please tell me what I'm doing wrong here?

Thanks in advance


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 
K

Ken Snell

Hmmm...strange. I'd still be interested in seeing what you've set up so that
I can better understand this behavior. Let me know. Glad you got it working.

--
Ken Snell
<MS ACCESS MVP>

What-a-Tool said:
Thanks for the generous offer - I got it working though

Have a named macro with my conditions - if that condition is true it runs my
called sub macro. This method works.

If I try to put multiple method calls under the condition itself, it just
runs everything, ignoring my conditions for some reason.

Like I said, I'm sure I was doing something stupid that I just didn't have
the experience to see.

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Ken Snell said:
If you can zip up a small sample of your database, email it to me (delete
this is not real from my email address) and I'll take a look at what you
have.

--
Ken Snell
<MS ACCESS MVP>

Actually ran on the click event of a button first.

Performs the same on the AfterUpdate and also Click event of the option
group.

Macro Name Condition Action

mcrCloseOptions [grpExit]=1 MsgBox
[grpExit]=2 MsgBox
[grpExit]=3 MsgBox

If there is nothing wrong with my sytax or methods, I must be doing
something stupid somewhere else - Thanks



--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Correct on all counts -

Running on AfterUpdate Event

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Offhand, I'd look first at your option group to be sure that the
values
of
each option control within it are what you expect. Is grpExit the
name
of
the frame that holds the options?

If the frame is named grpExit and each option control within it has the
correct data value assigned to it, then what you're describing doesn't
seem
possible. On which event are you running mcrCloseoptions?

--
Ken Snell
<MS ACCESS MVP>

Have a macro named mcrClose.
Within is a macro named mcrCloseoptions.
mcrCloseOptions has conditions relating to option group selection
and
is
run
on a button click:

[grpExit] = 1
[grpExit] = 2
[grpExit] = 3

As of now, all I have is a MsgBox function beside each condition
to
tell
me
if its working.
If I select #1, #1 and #2 run - same if I select #2
If I select #3, all three run.

Can anyone please tell me what I'm doing wrong here?

Thanks in advance


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 
S

Steve Schapel

Sean,

So, it appears that your macro is a bit more complex than originally
stated? I am not sure what you mean by "multiple method calls", but if
you want a Condition to apply to more than one macro action, you must
indicate this for each action, you can't just leave the Condition column
blank and expect the condition from the previous aaction to follow
through. The normal way of doing which is to enter the full expression
for the condition in the first action it applies to, and then entering
.... in the Condition for the subsequent actions it applies to.
 
W

What-a-Tool

Yeah - Sorry - I now see the stupid little thing I was talking about. It's
all clear now.

When I was testing the macro I had the condition followed by a Close Form
Action(which I failed to tell you), then on the next line (without rewriting
the condition) I had my message box Action.

I'm much more comfortable with VB than macros, where you have the logical
test, and then everything inside that test runs if its true. Guess I was
thinking VB instead of macro.

Thanks, Guys

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 

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