The ArcPad Team Blog

Unofficial stuff from the team behind the World's leading mobile GIS platform

Saturday, July 18, 2009

ArcPad Login Form



Overview:

A common field data collection requirement is to automatically store the field worker's name in an attribute. This allows captured/edited features to be traced back to the field worker responsible for the captured/edited features. This sample applet demonstrates one approach to supporting this requirement.

The applet consists of a login form with the following behavior:
  • When ArcPad starts, the user is presented with a login form
  • The field user can select his/her name from the list of valid users
  • If the field user refuses to login, ArcPad will exit
  • The selected name is stored in an user property that can be retrieved from any script

To customize for your project:
  • Replace the included Logo.jpg with your own Logo.jpg file
  • Replace the included UserNames.dbf with your own UserNames.dbf file

To retrieve the selected user name in a script:

Dim selectedUser
selectedUser = Application.UserProperties("LoggedInEmployee")

For example, if your layer has an attribute called EMPLOYEE, you can use the following code in the OnLoad event of the layer's Edit Form:

Dim pForm
Set pForm = ThisEvent.Object

If (2 = pForm.Mode Or 3 = pForm.Mode) Then
   pForm.Fields("EMPLOYEE").Value = Application.UserProperties("LoggedInEmployee")

End If


Set pForm = Nothing



To deploy the applet:
Copy the applet files (Login.apa, Login.vbs, Logo.jpg, UserNames.dbf) to the ArcPad applets folder and start ArcPad.

Download this sample from ArcScripts at: http://arcscripts.esri.com/details.asp?dbid=16477