Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Macros / January 2005

Tip: Looking for answers? Try searching our database.

Flow control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
souris - 26 Jan 2005 03:46 GMT
Hi All,

Does macro support flow control like "if" statement?
I would like to have my macro have if statement to run different query
depends on the condition.
Is it possible to have macro like this?
If not, are there any work around?
Thanks in advance,

Souris
tina - 26 Jan 2005 04:24 GMT
yes, you can do something "sorta like" that using a macro. use a conditional
statement to control which query runs, as

Condition:  Something is true
Action:    OpenQuery
Condition:    ... (ellipsis)
Action:    StopMacro
Condition:    Something else is true
Action:    OpenQuery
Condition:    ... (ellipsis)
Action:    StopMacro

if the first condition is true, the query will open and then the macro will
stop executing. if the first condition is false, the query will not open and
the macro will skip the second action and continue to the next condition,
and the cycle will repeat.

hth

> Hi All,
>
[quoted text clipped - 6 lines]
>
> Souris
souris - 26 Jan 2005 05:02 GMT
Thanks for the information,
Can you give me a sample condition?
I got "The text item you entered is not in the list" error when I enter
"..." or a condition.
Where I did wrong here?
Thanks millions,

Souris

> yes, you can do something "sorta like" that using a macro. use a
> conditional
[quoted text clipped - 28 lines]
>>
>> Souris
tina - 26 Jan 2005 21:07 GMT
your condition is whatever you want to test for True or False. it's the same
condition you would put in an IIf() function, such as

   MyFormControl = a certain value

or

   AValue + AnotherValue = ThisTotal

as for the ellipsis (...), you can't use it as the first condition in a
macro. it must always be the condition for an action subsequent to an action
with a Condition statement. suggest you search on "macro condition" in
Access Help, A2003 Help provides a lot of detail about macros and
conditions, including the use of ellipsis; and my guess is that A2000
probably has at least a reasonable amount of info, too.

hth

> Thanks for the information,
> Can you give me a sample condition?
[quoted text clipped - 37 lines]
> >>
> >> Souris
souris - 27 Jan 2005 03:37 GMT
Thanks for the information.

I have a control called "text3" on the form design.

I click Macro --> New.
There are 2 columns on the Macro edit form which are Action and Comment.
I tried to type in Text3.Text = 3, but I got "Item is not in the list"
error.

Can you please let me know where I did wrong here?
Thanks millions,

Souris

> Hi All,
>
[quoted text clipped - 6 lines]
>
> Souris
tina - 27 Jan 2005 07:34 GMT
open your macro in design view. on the menu bar, click View. on the drop
menu, click on Macro Names and Conditions. now you have all four columns
showing on your macro sheet. go back and read my first post, which is
talking about the Condition and Action columns - it should make more sense
now.

hth

> Thanks for the information.
>
[quoted text clipped - 20 lines]
> >
> > Souris
souris - 27 Jan 2005 23:52 GMT
Thanks millions,

Souris,

> open your macro in design view. on the menu bar, click View. on the drop
> menu, click on Macro Names and Conditions. now you have all four columns
[quoted text clipped - 28 lines]
>> >
>> > Souris
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.