[AccessD] OpenArgs Puzzle

Jim Dettman jimdettman at verizon.net
Fri Jun 19 12:49:36 CDT 2009


   Yes.  Controls may or may not exist during the Open event.  Either issue
a Me.repaint to force creation of all controls or move the code to the
OnLoad event.

  And FWIW, if you have multiple controls and/or arguments that you want to
pass, I use a delimited string like this:

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


 and call a routine like this:

        ' 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 let's hope this message makes it to the list.  Ones I sent yesterday
never made it.


Jim.

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

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Friday, June 19, 2009 12:37 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] OpenArgs Puzzle

I am opening a form and passing in an OpenArgs argument, then attempting to
assign that value to a text control in the OnOpen event, but it isn't
working. Is the OnOpen event the wrong place to do the assignment?
TIA,
Arthur
-- 
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