Runtime Parameters in Access

How do I pass a parameter to an application
at runtime? Specifically, a parameter that
AutoExec can examine in order to determine
which of two functions it should run.

I've tried to solve the problem by using the
/x MyMacroName, but AutoExec seems to
override that. 


0
Bill
1/1/2008 2:13:02 AM
access 16762 articles. 3 followers. Follow

11 Replies
1533 Views

Similar Articles

[PageSpeed] 18

On Mon, 31 Dec 2007 18:13:02 -0800, "Bill" <billstanton@psln.com>
wrote:

AutoExec runs before MyMacroName. So it's up to you to structure your
code such that this works for your purposes.

-Tom.



>How do I pass a parameter to an application
>at runtime? Specifically, a parameter that
>AutoExec can examine in order to determine
>which of two functions it should run.
>
>I've tried to solve the problem by using the
>/x MyMacroName, but AutoExec seems to
>override that. 
>
0
Tom
1/1/2008 2:26:09 AM
Tom,
Is there a way to pass an argument to AutoExec
from the invoking command line such that the
AutoExec could run one of two different functions?
Bill


"Tom van Stiphout" <no.spam.tom7744@cox.net> wrote in message 
news:m49jn3p2n2o77e9730s83tbaeho4qvfbcu@4ax.com...
> On Mon, 31 Dec 2007 18:13:02 -0800, "Bill" <billstanton@psln.com>
> wrote:
>
> AutoExec runs before MyMacroName. So it's up to you to structure your
> code such that this works for your purposes.
>
> -Tom.
>
>
>
>>How do I pass a parameter to an application
>>at runtime? Specifically, a parameter that
>>AutoExec can examine in order to determine
>>which of two functions it should run.
>>
>>I've tried to solve the problem by using the
>>/x MyMacroName, but AutoExec seems to
>>override that.
>> 


0
Bill
1/1/2008 2:34:32 AM
On Mon, 31 Dec 2007 18:34:32 -0800, "Bill" <billstanton@psln.com>
wrote:

No.

I might consider using AutoExec for general initializations, and
MyMacroName for more specialized processing.

Really, it's just a matter of getting your mind around the fact that
you have to structure your code such that both conditions work.

-Tom.


>Tom,
>Is there a way to pass an argument to AutoExec
>from the invoking command line such that the
>AutoExec could run one of two different functions?
>Bill
>
>
>"Tom van Stiphout" <no.spam.tom7744@cox.net> wrote in message 
>news:m49jn3p2n2o77e9730s83tbaeho4qvfbcu@4ax.com...
>> On Mon, 31 Dec 2007 18:13:02 -0800, "Bill" <billstanton@psln.com>
>> wrote:
>>
>> AutoExec runs before MyMacroName. So it's up to you to structure your
>> code such that this works for your purposes.
>>
>> -Tom.
>>
>>
>>
>>>How do I pass a parameter to an application
>>>at runtime? Specifically, a parameter that
>>>AutoExec can examine in order to determine
>>>which of two functions it should run.
>>>
>>>I've tried to solve the problem by using the
>>>/x MyMacroName, but AutoExec seems to
>>>override that.
>>> 
>
0
Tom
1/1/2008 2:45:14 AM
Okay, thanks. I'll think about how to accomplish
this without causing all kinds of updates in the field.
Bill


"Tom van Stiphout" <no.spam.tom7744@cox.net> wrote in message 
news:t6ajn313p21gvih7aqgdn14v44a925ilk6@4ax.com...
> On Mon, 31 Dec 2007 18:34:32 -0800, "Bill" <billstanton@psln.com>
> wrote:
>
> No.
>
> I might consider using AutoExec for general initializations, and
> MyMacroName for more specialized processing.
>
> Really, it's just a matter of getting your mind around the fact that
> you have to structure your code such that both conditions work.
>
> -Tom.
>
>
>>Tom,
>>Is there a way to pass an argument to AutoExec
>>from the invoking command line such that the
>>AutoExec could run one of two different functions?
>>Bill
>>
>>
>>"Tom van Stiphout" <no.spam.tom7744@cox.net> wrote in message
>>news:m49jn3p2n2o77e9730s83tbaeho4qvfbcu@4ax.com...
>>> On Mon, 31 Dec 2007 18:13:02 -0800, "Bill" <billstanton@psln.com>
>>> wrote:
>>>
>>> AutoExec runs before MyMacroName. So it's up to you to structure your
>>> code such that this works for your purposes.
>>>
>>> -Tom.
>>>
>>>
>>>
>>>>How do I pass a parameter to an application
>>>>at runtime? Specifically, a parameter that
>>>>AutoExec can examine in order to determine
>>>>which of two functions it should run.
>>>>
>>>>I've tried to solve the problem by using the
>>>>/x MyMacroName, but AutoExec seems to
>>>>override that.
>>>>
>> 


0
Bill
1/1/2008 2:50:12 AM
Actually, why not? You may accomplish it in this way:

1. Pass your parameter:
"C:\...\MSACCESS.EXE" "C:\Db1.mdb" /cmd Par1

2. Build Autoexec:
Condition                        Action
----------                       ----------
Command()="Par1"        Macro1
....                                   StopMacro
                                      Macro2

3. That's all ;-)

You can alternatively set start form and solve in code this:
Private Sub Form_Load()
    If Command() = "Par1" Then
        'Action 1
    Else
        'Action 2
    End If
End Sub


Kris, MVP Poland
www.access.vis.pl


(...)
> No.
>
> I might consider using AutoExec for general initializations, and
> MyMacroName for more specialized processing.
>
> Really, it's just a matter of getting your mind around the fact that
> you have to structure your code such that both conditions work.
>
> -Tom.
>
>
>>Tom,
>>Is there a way to pass an argument to AutoExec
>>from the invoking command line such that the
>>AutoExec could run one of two different functions?
>>Bill
(...) 


1
Krzysztof
1/1/2008 11:23:07 AM
I've coded the following macro and I don't see why it does not
function properly. Even as I single-step the macro it doesn't run
the code specified in the Function Name field corresponding to
the condition action.

Condition                          Action
------------------------    ------------
Command() = "DBDist"    Runcode        run fx DBDistribution()
                                        StopMacro
                                        Runcode        run fx ScrRes()

The intent is to run DBDistribution() if the invoking line command
includes the expression /cmd DBDist or ScrRes() if the expression
is missing.

Bill 


0
Bill
1/1/2008 8:42:26 PM
(...)
> Condition                          Action
> ------------------------    ------------
> Command() = "DBDist"    Runcode        run fx DBDistribution()
>                                        StopMacro
>                                        Runcode        run fx ScrRes()
>
> The intent is to run DBDistribution() if the invoking line command
> includes the expression /cmd DBDist or ScrRes() if the expression
> is missing.
>

You forgot adding three dots in Conditions column.

 Condition                          Action
 ------------------------    ------------
 Command() = "DBDist"    Runcode        run fx DBDistribution()
 ...                                    StopMacro
                                        Runcode        run fx ScrRes()

Above ... is important :-)



Kris, MVP Poland
www.access.vis.pl




0
Krzysztof
1/1/2008 9:33:00 PM
(...)
> Condition                          Action
> ------------------------    ------------
> Command() = "DBDist"    Runcode        run fx DBDistribution()
>                                        StopMacro
>                                        Runcode        run fx ScrRes()
>
> The intent is to run DBDistribution() if the invoking line command
> includes the expression /cmd DBDist or ScrRes() if the expression
> is missing.
>

You forgot adding three dots in Conditions column.

 Condition                          Action
 ------------------------    ------------
 Command() = "DBDist"    Runcode        run fx DBDistribution()
 ...                                    StopMacro
                                        Runcode        run fx ScrRes()

Above ... is important :-)  It marks the continuation of previous condition.



Kris, MVP Poland
www.access.vis.pl


0
Krzysztof
1/1/2008 10:39:11 PM
Wouldn't that mean I need ... on the 3rd line as well?

Like:

 Condition                          Action
 ------------------------    ------------
 Command() = "DBDist"    Runcode        run fx DBDistribution()
 ...                                     StopMacro
 ...                                     Runcode        run fx ScrRes()



"Krzysztof Pozorek [MVP]" <access@vis.pl> wrote in message 
news:uwpIlcMTIHA.5264@TK2MSFTNGP02.phx.gbl...
> (...)
>> Condition                          Action
>> ------------------------    ------------
>> Command() = "DBDist"    Runcode        run fx DBDistribution()
>>                                        StopMacro
>>                                        Runcode        run fx ScrRes()
>>
>> The intent is to run DBDistribution() if the invoking line command
>> includes the expression /cmd DBDist or ScrRes() if the expression
>> is missing.
>>
>
> You forgot adding three dots in Conditions column.
>
> Condition                          Action
> ------------------------    ------------
> Command() = "DBDist"    Runcode        run fx DBDistribution()
> ...                                    StopMacro
>                                        Runcode        run fx ScrRes()
>
> Above ... is important :-)  It marks the continuation of previous 
> condition.
>
>
>
> Kris, MVP Poland
> www.access.vis.pl
>
> 


0
Bill
1/2/2008 2:36:31 AM
U�ytkownik "Bill" <billstanton@psln.com> napisa� w wiadomo�ci 
news:DuWdnavZ3uM5ZefanZ2dnUVZ_judnZ2d@trueband.net...

> Wouldn't that mean I need ... on the 3rd line as well?
>
> Like:
>
> Condition                          Action
> ------------------------    ------------
> Command() = "DBDist"    Runcode        run fx DBDistribution()
> ...                                     StopMacro
> ...                                     Runcode        run fx ScrRes()
>
>



;-)

 Look on passed by me example attentively. Only_one_line contains dot.

Command() = "DBDist"    Runcode        run fx DBDistribution()
 ...                                    StopMacro
                                       Runcode        run fx ScrRes()



 Kris, MVP Poland
 www.access.vis.pl


0
Krzysztof
1/2/2008 7:02:25 AM
Okay, thank you.
Bill


"Krzysztof Pozorek [MVP]" <access@vis.pl> wrote in message 
news:uYsqy1QTIHA.3916@TK2MSFTNGP02.phx.gbl...
> U�ytkownik "Bill" <billstanton@psln.com> napisa� w wiadomo�ci 
> news:DuWdnavZ3uM5ZefanZ2dnUVZ_judnZ2d@trueband.net...
>
>> Wouldn't that mean I need ... on the 3rd line as well?
>>
>> Like:
>>
>> Condition                          Action
>> ------------------------    ------------
>> Command() = "DBDist"    Runcode        run fx DBDistribution()
>> ...                                     StopMacro
>> ...                                     Runcode        run fx ScrRes()
>>
>>
>
>
>
> ;-)
>
> Look on passed by me example attentively. Only_one_line contains dot.
>
> Command() = "DBDist"    Runcode        run fx DBDistribution()
> ...                                    StopMacro
>                                       Runcode        run fx ScrRes()
>
>
>
> Kris, MVP Poland
> www.access.vis.pl
>
> 


0
Bill
1/2/2008 1:31:51 PM
Reply:

Similar Artilces:

Access Crashes
I have a database with reports referencing queries that pull out of my business software. Everything worked fine until this week. I can't open any reports, can't even click on report wizard to start a new report and the system crashes with the usual "..has encountered a problem and needs to shut down error". Basically I can't do anything anymore. Other people with older versions of access (I have 2007) can open the reports from their computer, and print them, no problems. I have reinstalled Office, no luck. Rebooted, no luck. I installed an older version of Access...

OUTLOOK WEB ACCESS #24
We have a user that when typing the http://web outlook access address , it opens her default outlook folders . She never gets a login and password screen . Any input is much appericiated. Thank You Exchange 2003? if so, that's the way it's supposed to work...if she's logged onto the PC with the account that access to her mailbox, this is by design... -- Susan Conkey [MVP] "esfandiarfard" <esfandiarfard@discussions.microsoft.com> wrote in message news:1A405538-5755-4A4D-901E-A6DCC3405121@microsoft.com... > We have a user that when typing the http://web out...

Outlook Web Access AutoSignature
I would like to know if it's possible to have autosignature in Outlook Web Access, and if so how to implement it. If anyone can help, it would be greatly apreciated. Thank You. It depends on the version of Exchange - Outlook Web Access is a function of Exchange, not Outlook. Exchange 2003 does this natively, previous versions may have a third party add-in that will allow users to do this. For better information, post in an exchange group such as microsoft.public.exchange.admin. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due t...

How to stop access confirmation in Outlook
When I try to sync my PDA/Phone with Outlook (2000) it ask for me to allow access for 'x' number of munites. How do I stop this request? Thanks Clive Try updating your PDA sync software. (If the PDA uses Activesync, upgrade to 3.7x) And if you are curious to know how/why you are getting the prompt, see the following links. http://www.slipstick.com/outlook/esecup.htm http://www.slipstick.com/outlook/esecup/admin.htm -- Neo [MVP Outlook] Due to the Swen virus, all e-mails sent to this account will be deleted w/out reading. "Clive" <someone@NOTHANKS.com> wrote i...

Address Labels in Access 2007?
I had no trouble creating labels in the previous version of Access, but I have problems with Access 2007. It makes me "jump through hoops" t open the old labels, from Access 97, what few there are that are left. I don't know how to create the database for the labels in ACcesss 2007. Help, please. Thanks on the Create ribbon in the Reports group there is an icon for Labels Warm Regards, Crystal remote programming and training http://MSAccessGurus.com free video tutorials http://www.YouTube.com/user/LearnAccessByCrystal Access Basics http://www.AccessMV...

Security Access to a database
my partner and I are the administrators of our database when it was 2003. We brought the database into 2007 and everything seemed alright till we created a backend database and used the frontend to input data as we did with no problems in 2003. Now it won't let us access the database, back or front end. Is there a way to wipe out the security settings and start clean? Bernie, Access 2007 requires that the files be in a Trusted Location. Have a look at... http://www.regina-whipp.com/index_files/TrustedLocation.htm Oh, and you can't *wipe that out*. -- G...

Link Access table to Excel worksheet
I want to link these so that they can be edited in either programme. Whichever way, the link box is greyed out. You can make a linked table in Access. It's File - Get External Data - Link. The data lives in the Excel workbook, I think (I don't think Access keeps a copy of it). But you can change data in either Excel or Access. -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "dalesrunner" <dalesrunner@discussions.microsoft.com> wrote in message news:A165D6C6-D173-45F7-94D5-352E3AA5121E@microsoft.com... ...

NEEDED: MS ACCESS 2003 Consultant
Our company has been using Lotus Approach database software since the early 90's until last year when we migrated to MS Access 2003. Problem: Our database is NOT normalized, therefore creating redundant and inconsistent information, as well as disorganized data. When the databases were ported to Access last year, we did the best we could to make the redundancy and inconsistency of data as little as possible. Unfortunately we could only accomplish this task to a certain extent, and as a result we are now experiencing scalibilty and normalization issues. Solution: We are looking to hire...

Access-Forms-VB links
After years in software development/database programming mostly on Unix/Oracle I'm tasked to change some Access forms to use redesigned tables. I'm having trouble with the relationship between forms and VB. For example I'm looking at some VB code that frequently references the Me class which I assume to be the default reference to the current (form) class (like this in C++), but I can't see how/where the class is actually defined. Can someone please provide some links that provide concise explanations of the relationship between Access and VB. My googling has only turned up pag...

Accessing Spreadsheet Documents (Works Suite 2003)
I recently converted over from a Mac to Windows. I had several spreadsheet documents that I converted using Maclink. They converted over okay. But, when I try to use them, and then wanted to save them, I have to save in Works 7.0. Then when I try to open them up I get the following type message: BUW1, contains a formula reference outside the area that Works can access. There are other similiar references like: LDI1, KMS1, AND MX1. I do not know how to remove these problems so that I may utilize the documents. Please help. Thanks. JB I'd suggest asking this in a Works gr...

Sinking MS Access form events from MFC console app
Hi All, I'm trying to sink MS Access form events using technique described in <<HOW TO: Handle Events for Excel by Using Visual C++ .NET (http://www.kbalertz.com/Q309301/Handle.Events.Excel.Using.Visual.aspx)>> Of course I did do all the needed code substitutions etc. All works rather well, I mean I'm getting to MS Access form IConnectionPointContainer etc. But the last code line - hr = m_pConnectionPoint->Advise(m_pAppEventListener,&m_dwConnectionCookie); doesn't work and returns hr = -2147220990. Here is MS Access form events interface ID I use: const II...

Using Access Excel Automation, can I delete or rename a worksheet
Hi I am using automation to produce an excel workbook from an access database. Everything is working fine, except that my workbooks always have 3 additional worksheets - sheet 1, sheet 2 and sheet 3. Can I delete these, or rename them? Stapes On 13 Sep, 11:04, Stapes <steve.sta...@gmail.com> wrote: > Hi > > I am using automation to produce an excel workbook from an access > database. Everything is working fine, except that my workbooks always > have 3 additional worksheets - sheet 1, sheet 2 and sheet 3. Can I > delete these, or rename them? > > Stapes Found ...

MS Access 2002 SQL to Oracle 9 PL/SQL
Are there any products that can convert MS Access 2002 SQL to Oracle 9 PL/SQL? I do NOT want to convert the database, only the SQL statements. Thank you. Posted on: microsoft.public.access.conversion microsoft.public.access.odbcclientsvr microsoft.public.access.queries Did you ever find an SQL converter? I'm facing a similiar issue. Thanks, Todd "MartinX" wrote: > Are there any products that can convert MS Access 2002 SQL to Oracle 9 > PL/SQL? I do NOT want to convert the database, only the SQL statements. > > Thank you. > > Posted on: > microsoft...

Outlook 2000 after XP upgrade: "unable to access folders"
I just upgraded from ME to XP. All if a sudden my shortcut buttons for inbox, outbox, deleted items, and everything else results in a message: "Unable to display the folder: unable to display the folder: folder no longer exists." I am, however, able to access these folders using the toolsbars view>go to. So these folders must exist, but apparently do not appear in the place that Windows XP expects them. Can anybody offer any suggestions or advice? Thanks, Sandor J. Woren window Try starting outlok from the Run command ...

Linking chart parameters to cells
Is anyone aware of a way of linking chart parameters normally set in the various dialog boxes, to a value in a cell. For example, suppose I'd like the value (Y) axis minimum and maximum value to change based on the value of a certain formula, can I somehow link those values to a cell in the spreadsheet. If not, it'd be cool if I could. Maybe the next version of Excel? >-----Original Message----- >Is anyone aware of a way of linking chart parameters >normally set in the various dialog boxes, to a value in a >cell. For example, suppose I'd like the value (Y)...

Working window in Access "sticks" to Maximum size
Hello, I'm trying to figure out how to 'unstick' a working form/report/table, etc in Access. Even if I design an entry form at say, 3" by 5" wide, it'll automatically maximize to fill up the entire working screen next to the navigation bar. To my knowledge, I have never set any property to maximize every window. . . Did I miss a global setting, or is it an option I can turn off? Thanks, Tripler "Tripler of the SDMB" <Tripler of the SDMB@discussions.microsoft.com> wrote in message news:96E65DF9-A187-4710-A6AC-2350A66F38D1@microso...

ActiveX control is not shown correctly in Access Reports print pre
Hi All, we are developing ActiveX control's to use in MS Access. The control works fine with Access form in design mode and running mode. But in case of reports the design mode shows the control correctly but when comes to print preview mode, the size and drawing on the control is not working properly. The same control works fine with Access 2002. The problem is found to be with Access 2000. We need to enable XP theme from UxTheme.dll(Microsoft provide) if theme is avaible in the system. The drawing of theme is alo goes wrong in Access 2000 reports print preview mode. please help ...

Using Outlook Parameters
Hi All, I have a quick question regarding the parameters of outlook 2007. I am trying to use the /a and /m to open a email with attachment and enter a series of email addresses. I have it working on my machine, however it is not working on another PC at work. According to Microsoft it can not be done, but I have done it. Does anyone know how to make this work? IF not is there another way to open an email with attachment and enter email addresses? Regards James -- James MacDonald-Fawcett Are you using Outlook 2007 and using the exact same method on both computers? In 2007, /a /m ...

How can I put photos in Microsoft Access Form
I used the information BobLarson said in putting photos in Microsoft Access Form but it's not working. My computer keeps asking for Form1, which I deleted because nothing was happening the way I wanted it to. What I would like to know is there a online video that can show how you can do this procedure. And how can I get my computer stop asking for Form1. "Helen" <Helen@discussions.microsoft.com> wrote in message news:8E015B36-D605-428D-9275-C95DAC1DC3AE@microsoft.com... >I used the information BobLarson said in putting photos in Microsoft Access > For...

Dynamically Setting a forms Input Parameter Property
Hi , I'm working with a ADP project, I have a form where I set the recordset property at design time to a SQLServer stored procedure that has one parameter. If I set the Input Parameter property of the form at design time all is well. However I'd like to be a little more flexible in that I have the calling object that Opens the form using Docmd.Openform pass OpenArgs to the form. On the Form_Open event I set the InputParameter property of form using the value in OpenArgs. The problem is I'm still prompted with the parameter popup..if I press Ok everything continue on and ...

anyone else seen problem using LEN() function in Runtime?
HI. I have an applicaiton that for one of the combo boxes has a query that uses the Len() function to shorten the description length for sorting the list. Eg: Right([Partdescription],(Len([PartDescription])-11)) This was working fine - however having loaded the AccessRT.msp Runtime pre-release patch from microsoft to fix the SaveAsPDF addin problem the len function doesnt work. I have even tried to generate a standalone app that has a Form with a button and the VB code has a Msgbox Len([Me]![ErrorBox]) Under the runtime with the pre-release patch the msgbox does not display. Under ...

CRM 1.2: Access denied on viewig Accounts and Contacts
I recently had to rebuild my CRM 1.2 database. Since then, users get an 'Access denied' message when viewing the details of accounts and contacts. It seems that teh security descriptors are invalid. My questions are: 1. I intend upgrading to CRM3.0 anyway - is this going to rebuild security that will bypass this error or am I just importing incorrect parameters as it is? 2. Changing roles and using 'Repar Object Security' with the admin tool did not fix the issue. Is there another way that I can rebuild the security descriptors If anybody cna put me on the right track, I...

Can an Access PivotChart display standard deviation error bars?
I'm using Office 2003 in a medical device field to manage a quality assurance database. The engineers who will be using the database need to know the statistical significance of all data, and it is standard to show all charts with standard deviation, percentile, or max/min plots. I'd like to be able to make a PivotChart view that gives this information, but have not been able to find a way of displaying custom error bars calculated for each data point (as is possible for static charts in Excel, by selecting a data range for the "Custom" error bar data fields). This p...

access denied
I am running GP7.5 with a 3 user licence. 3 users were logged onto GP when we had a server problem. We could not probably log out of GP before we had to reboot the server. Therefore, when the server was back up and we tried to log back into GP it would not allow us because it still thinks 3 users are logged onto the system even though they are not. What should I do? -- lester lester wrote: > I am running GP7.5 with a 3 user licence. 3 users were logged onto > GP when we had a server problem. We could not probably log out of GP > before we had to reboot the server. > ...

Accessing Mailbox
I have a client who is trying to access another mailbox. He has an account in domain A and one is domain B. The user domains do not trust each other, but the Exchange Server domains do. I had this similar issue a little while ago, and created an lmhosts file and multiple Outlook profiles so that Outlook will prompt for login information when accessing the othter mailbox. Since then, we have upgraded to Win2K and Office 2000- in this case we are using Outlook 2000. I can't get Outlook to prompt for the login information- I just get an error saying "You do not have permission t...