[AccessD] OpenArgs issue in A2207

Heenan, Lambert Lambert.Heenan at chartisinsurance.com
Wed Jun 16 14:23:27 CDT 2010


Glad to be of help.

Regarding the different syntax: you can use that way for almost all VBA subs and functions. This is called using Named Arguments, and you can find it discussed in the help file...

"When you call a Sub or Function procedure, you can supply arguments positionally, in the order they appear in the procedure's definition, or you can supply the arguments by name without regard to position.

For example, the following Sub procedure takes three arguments:

Sub PassArgs(strName As String, intAge As Integer, dteBirth As Date)
    Debug.Print strName, intAge, dteBirth
End Sub

You can call this procedure by supplying its arguments in the correct position, each delimited by a comma, as shown in the following example:

PassArgs "Mary", 29, #2-21-69#

You can also call this procedure by supplying named arguments, delimiting each with a comma.

PassArgs intAge:=29, dteBirth:=#2/21/69#, strName:="Mary"
"

Lambert

-----Original Message-----
From: David McAfee [mailto:davidmcafee at gmail.com] 
Sent: Wednesday, June 16, 2010 2:21 PM
To: Heenan, Lambert
Subject: Re: [AccessD] OpenArgs issue in A2207

That was it Lambert! I totally forgot "When in doubt...Decompile!" :)

Found an error in a function (which wasn't being used or tested yet) that I copied over from a different form.
It contained a field which did not exist in this form.

Also thanks for the different way of opening a form without the commas. I've never seen that before.

Thanks again everyone,
David

On Wed, Jun 16, 2010 at 11:05 AM, Heenan, Lambert <Lambert.Heenan at chartisinsurance.com> wrote:
>
>  Have you tried decompiling this MDB file? I just had an issue today getting spurious Error 49's (Bad DLL calling convention). In stepping thought the code I saw that the error was happening when a Sub call returned , but no error had happened in the sub, yet my code execution jumped directly into the error handler.
>
> I quick decompile and the problem went away.
>
> On another note, instead of using all those commas for the optional 
> parameters to .OpenForm you can use this syntax (but it still will not 
> solve your problem)
>
> docmd.OpenForm "frmRpoAddPart",OpenArgs:="2|966"
>
> Lambert
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David 
> McAfee
> Sent: Wednesday, June 16, 2010 1:40 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] OpenArgs issue in A2207
>
> This is nuts.
>
> It now shows up as null, no matter what I try, if I call it from the 
> immediate window
>
> docmd.OpenForm "frmRpoAddPart",,,,,,"2|966"
>
> but if I call it from another form, it works as suggested.
>
> I usually do use a global function, but I wanted to open a quick form in one of three modes, so I thought a quick pass of a variable would work.
>
> I hate how something so stupid and simple can hold me up like this. :)
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>




More information about the AccessD mailing list