[AccessD] Openargs Mystery

Bill Benson bensonforums at gmail.com
Tue Apr 29 10:43:22 CDT 2014


Doesn't diminish the value of using a table for the same purpose and
calling a function to extract,  use... even edit... the "OpenArgs" table if
by naming it that way I make a small concession in favor of a property
which I have come to quite happily exist without.

And I am not putting down OpenArgs... just refuse to welcome them with
OpenArms.

As our esteemed colleague Darryl is fond of saying, YMMV and Horses for
courses.

I prefer Hearses for Curses.

; l
On Apr 29, 2014 11:35 AM, "Rocky Smolin" <rockysmolin at bchacc.com> wrote:

> I have used OpenAgrs extensively since I 'discovered' them.  The most
> useful
> thing I found is to combine OpenArgs with the split function to pass
> multiple arguments.
>
> I have an audit trail form which pops up when the user does an inventory
> transaction.  It has a lot of fields and can be called from a variety of
> places in the application and lots of different sources for the same field
> in the audit trail record.
>
> So I call it like this concatenating the arguments separated by commas:
>         DoCmd.OpenForm "frmAuditTrail", , , , , acDialog, (Me.PartNumber &
> "," _
>             & dblDiff & "," _
>             & dblOldQOH & "," _
>             & dblOldQOH + dblDiff & "," _
>             & Nz(Forms!frmSupplySide!txtStandardCost) & "," _
>             & Nz(Me.OrderNumber, "") & "," _
>             & 2)
>         End If
>
> Then in the audit trail form I Dim varOpenargs() As String
>
> And in the _Open event simply
>
>     ' parse OpenArgs
>     varOpenargs() = Split(Nz(Me.OpenArgs), ",")
>
> Each of the arguments is then available in the varOpenArgs array.  For
> example:
>
> ' OpenArgs
> ' 0 part number
> ' 1 transaction quantity
> ' 2 old balance
> ' 3 new QOH
> ' 4 std cost
> ' 5 audit reference
> ' 6 audit type
> ' 7 lot serial
> ' 8 source location
> ' 9 target location
> '10 old source QOH
> '11 old target QOH
> '12 new source QOH
> '13 new target QOH
>
> ' 1) Shipment, 2) Receipt, 3) To WIP,
> ' 4) Physical Inv., 5) Dir Chg. QOH,
> ' 6) Shortage, 7) Scrap 8) Edit MIL, 9) Other
>
>     Me.txtPartNumber = varOpenargs(0)
>     Me.txtXactQty = varOpenargs(1)
>     Me.txtOldBalance = varOpenargs(2)
>     Me.txtNewBalance = varOpenargs(3)
>     Me.txtStandardCost = Format(varOpenargs(4), "###,###,###.####")
>     Me.txtTotalStandardCost = Val(Nz(varOpenargs(1))) * Val(varOpenargs(4))
>     If gdblActualCost = 0 Then
>         Me.txtActualCost = Format(varOpenargs(4), "###,###,###.####")
>         Me.txtTotalActualCost = Val(Nz(varOpenargs(1))) *
> Val(varOpenargs(4))
>     Else
>         Me.txtActualCost = Format(gdblActualCost, "###,###,###.####")
>         Me.txtTotalActualCost = Val(Nz(varOpenargs(1))) * gdblActualCost
>     End If
>
> HTH someone
>
> Rocky
>
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson
> Sent: Tuesday, April 29, 2014 8:13 AM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Openargs Mystery
>
> This is more like it!
>
> Thanks Jim, I agree with you.
>
> Art, you can cancel my request unless you disagree with Jim!
>
> 'Twould be a purdy stupid property that dissipates just before you need it.
> Kinda the opposite of Experience, which doesn't show up until after you
> need
> it.
>
> For the record, I believe in global variables and SaveSettings/GetSettings
> -
> even, on occasion, in temp tables - because you can reach and/or modify
> these at will from all over an application (even after a Compact & Repair
> in
> the latter's case...) without relying on something sent into an opening
> form's arguments.
>
> I guess I might use OpenArgs if I knew for sure I would never open a form
> recursively or open one form that might consume/destroy the data I could
> possibly need for another form. On the other hand, the same logic that
> tells
> me what to set for OpenArgs could be telling me what to be storing as which
> controllers, for which Forms, in an OPENING_DIRECTIVES table which I intend
> to look up to from within the opening form. That way I get different data
> types to play with, not some densely populated string which OpenArgs is.
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Dettman
> Sent: Tuesday, April 29, 2014 10:59 AM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Openargs Mystery
>
>
> Their good for the life of the form as long as you don't break code
> execution.
>
> Jim.
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
> Sent: Tuesday, April 29, 2014 10:39 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Openargs Mystery
>
> Rocky,
>
> This is known behaviour. If you really want to keep the OpenArgs then grab
> them immediately and store them; otherwise they are toast as soon as
> anything happens.
>
>
> On Tue, Apr 29, 2014 at 10:32 AM, Gustav Brock <gustav at cactus.dk> wrote:
>
> > Hi Rocky
> >
> > Have you tried removing the call of adhScaleForm?
> >
> > /gustav
> >
> > -----Oprindelig meddelelse-----
> > Fra: accessd-bounces at databaseadvisors.com [mailto:
> > accessd-bounces at databaseadvisors.com] På vegne af Rocky Smolin
> > Sendt: 29. april 2014 15:52
> > Til: 'Access Developers discussion and problem solving'
> > Emne: [AccessD] Openargs Mystery
> >
> > Dear List:
> >
> > I call a form which is bound to a table with a list of companies.  The
> > called form is where the data for the company is entered/edited.  So I
> pass
> > the autonumberID, the PK of the company to the called form, do a
> FindFirst,
> > and walla! company is displayed.  I use this technique a lot.
> >
> > So the calling statement is:
> >
> >       DoCmd.OpenForm "frmAssociations", , , , , ,
> > Me.fldSRAssociationID
> >
> > I put a breakpoint here and hover over Me.fldSRAssociationID and sure
> > enough the value  10005 is in Me.fldSRAssociationID.
> >
> > Press F8 and the _Open event of the called form executes:
> >
> > Private Sub Form_Open(Cancel As Integer)
> >
> >     Call adhScaleForm(Me, 1600, 800, 96, 96, rctOriginal)
> >
> >     If Not IsNull(Me.OpenArgs) Then
> >         Me.RecordsetClone.FindFirst "fldAssociationID = " &
> > Val(Me.OpenArgs)
> >         Me.Bookmark = Me.RecordsetClone.Bookmark
> >     End If
> >
> > End Sub
> >
> > At the point where the first line of code is ready to execute (I'm in
> > break mode now so the execution stops on every line) I hover over
> > Me.OpenArgs and it shows Me.OpenArgs = Null.
> >
> > Where's my OpenArg?  Why does it disappear.  I never saw this behavior
> > before.  Any ideas?
> >
> > This is A2003 BTW.
> >
> > MTIA
> >
> > Rocky
> >
> >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
>
>
>
> --
> Arthur
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
> --
> 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