[AccessD] Solution Looking for a Problem

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Thu Jan 22 08:37:18 CST 2009


Sometimes I feel like a foreigner who's been speaking English for 10 years.
I'm pretty fluent in VBA.  Then one day I discover some really useful basic
word and wonder if I'll ever really know the language.  Split/Join. Who
knew? 


Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com
www.bchacc.com
 
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jim Dettman
Sent: Thursday, January 22, 2009 5:02 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Solution Looking for a Problem


  Been doing that since A2 days<g>.  All this is nothing new; it's straight
out of the ADH.  Typical call with open args:

"ADD;SETCTRLTODATA=txtCustomerID:" & NewData & ";EXITTOFORM=frmLoad"

 and the generic form routine:

      ' Set any controls required by calling form.
      varOpenArgs = Nz(frm.OpenArgs, "")
      If Not (varOpenArgs = "") Then
        var = glrGetTagFromString(varOpenArgs, "SETCTRLTODATA")
        If Not IsNull(var) Then Call SetControlsToData(frm, Mid$(var, 1))
      End If

And the actual routine:

Sub SetControlsToData(frm As Form, strData As String)

  ' Set controls on frm to values contained in strData.
  ' Delimiter is a ":".  Format of strData is control name: value.
  
  Dim intPairNumber As Integer
  Dim varControlName As Variant
  Dim varData As Variant
  intPairNumber = 1

  Do
    varControlName = dhExtractString(strData, intPairNumber, ":")
    If varControlName = "" Then Exit Do
    varData = dhExtractString(strData, intPairNumber + 1, ":")
    frm(varControlName) = varData
    intPairNumber = intPairNumber + 2
  Loop

End Sub

  John's not the only one with a framework, although I don't as much class
stuff as he does.  Most of my stuff was written along ago and works well
enough not to tinker with it.

Jim. 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka
Sent: Wednesday, January 21, 2009 7:02 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Solution Looking for a Problem

For doing something like this, you could go even further and do this:

OpenArgs="txtPartNumber=Something|txtXactQty=Somethingelse"

Dim strArray() as String
Dim strItems() as String
Dim I as long
strArray=split(me.OpenArgs,"|")
for i=0 to ubound(strArray)
	strItems=Split(strArray(i),"=")
	Me(strItems(0))=strItems(1)
Next i

That way you can change the open arguments without changing the code behind
the form.  Of course, this only works if you are just setting the values of
controls.

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin at
Beach Access Software
Sent: Wednesday, January 21, 2009 2:46 PM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Solution Looking for a Problem

I needed to pass multiple arguments to a pop up form through OpenArgs.
So I
needed to parse them.  Found this on the web:
 
Dim Hold_OpenArgValues() as String
Hold_OpenArgValues()=Split(Me.OpenArgs, "|")
 
except I DIMmed Hold_OpenArgValues as varOpenArgs as Variant.
 
and walla!  the three comma delimited arguments I passed showed up just
where they were supposed to:
 
    Me.txtPartNumber = varOpenargs(0)
    Me.txtXactQty = varOpenargs(1)
    Me.txtAuditReference = varOpenargs(2)

Note the array is zero based. 
 
One line to parse openargs! (not counting the DIM)  
 
Who knew?
 


 	
	
 

Rocky Smolin

Beach Access Software

858-259-4334

www.e-z-mrp.com <http://www.e-z-mrp.com/> 

www.bchacc.com <http://www.bchacc.com/> 

 

 


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com The information contained in this
transmission is intended only for the person or entity to which it is
addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive
material. If you are not the intended recipient, please contact the sender
immediately and destroy the material in its entirety, whether electronic or
hard copy. You are notified that any review, retransmission, copying,
disclosure, dissemination, or other use of, or taking of any action in
reliance upon this information by persons or entities other than the
intended recipient is prohibited.


-- 
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