Determine if the user clicked ok or cancel when using PickListStrings

If the user clicks Cancel, picklist returns nothing, if the user clicks OK picklist is populated with a string array value. You cannot use If picklist is Nothing in this situation because it will return an error when the user clicks OK. The solution is to use the Datatype function to determine what datatype picklist is. Clicking Cancel causes the datatype to = 0 . Any other value will be covered by the Else shown below.

Dim EmployeeUniqueID As String
Dim picklist As Variant
picklist = workspace.Pickliststrings( PICKLIST_CUSTOM, False , Server , Path &_
"archive.nsf", "ADb", "Archive", "Please select an employee to archive.", 2 , "" ) 
Dim PType As Variant
PType = Datatype ( picklist )
If PType = 0 Then
	Exit Sub
	EmployeeUniqueID = picklist(0)
End If

Posted by fbrefere001 on Wednesday February 27, 2002