Using this blog post I've managed to store user names as global variables in ArcPad. The next step is to use those variables in form 'controls' aka form fields.

Per the author's comments under his original quote I've attempted to go this route:

  • If you are writing the value to a field that is linked to a control on the form, set the control value: pForm.Pages("PAGE1").Controls("EMPLOYEE").Value = Application.UserProperties("LoggedInEmployee")

Unfortunately I'm not getting anything written into the field when I open the form (this is an onLoad event handling script). I'm not getting an error message at this point, and the value in the control box is changing from to being totally empty.

I have managed to 'echo' or 'alert' back the user-name with Application.MessageBox Application.UserProperties("LoggedInEmployee") associated with an onUnload event, so I know that it's stored properly.

Any Ideas?

  • What type of control are you trying to write the value into? If I recall, if it's a drop down control you may not be able to just assign a value as you are doing.
    – MWrenn
    Apr 24, 2012 at 18:18
  • It's a text field, but it has a domain (there is a preset list of names contained in a drop-down menu). I figured that I wouldn't be able to insert a NEW value, but one within the domain should work. I suppose that's a good question for the script's author.
    – Roy
    Apr 24, 2012 at 19:07

1 Answer 1


I use an old version of ArcPad - 7.1.1, so I don't know how much of this info applies, but in the control properties for this drop down control, is there a 'limit to list' control and is it checked? That would prevent new values not present in the domain from being entered.

Here's the code I use to set values in drop down boxes, and I'm pretty sure it's boiler plate code generated by ArcPad, so it may already be in your project :

'#### Sets input combo box's listindex to match input value
Sub SetCboValue (ByRef pCbo, pValue)
  Dim intI
    For intI = 0 To pCbo.ListCount-1 
      pCbo.ListIndex = intI
      If CStr(pCbo.value) = CStr(pValue) Then 
        Exit For 
      End If 
    'If the value was not found, make nothing selected in combobox
    If CStr(pCbo.Value) <> CStr(pValue) Then
      pCbo.ListIndex = -1
    End If 
End Sub

Use it like this :

SetCboValue pForm.Pages("PAGE1").Controls("EMPLOYEE"), Application.UserProperties("LoggedInEmployee")

Like I said, this is from version 7.1.1 so I don't know if this applies or not.

  • Limit to list doesn't appear to be an option in version 10.0.3 -- when you say boiler plate code generated by ArcPad, is ArcPad composing code for you? The code you have written for "Use like this," is that the function call (I'm much more comfortable with Python compared to VBS).
    – Roy
    Apr 25, 2012 at 11:26
  • 1
    I inherited the ArcPad project I work on, so I've never created one from scratch, but that SetCboValue function is in every APL file in the project, so it's either a copy paste job by the original creator or code generated by ArcPad. And, yes, the second code block is how you would call the SetCboValue function to set the combobox to your logged in user. However, since you are on version 10, I really have no idea if this answer applies. See if setting the ListIndex property of your control to different indexes selects different items in the dropdown first.
    – MWrenn
    Apr 25, 2012 at 15:58
  • Thanks for the post, I'll give it a try -- Just to confirm the Controls("EMPLOYEE") represents the control name (Name field in control properties). I guess they've changed something along the way -- doesn't seem to work. Strangely, when I went back into the even handler to check the code, it was all greyed out?
    – Roy
    Apr 25, 2012 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.