<b>In a nutshell:
Here is the code. This code needs to access a field in another table called ARPAS
Within ARPAS is a field named “SWACTV” which contains a 1 or 0 depending on whether a salesperson is active(1) or not(0). I need the dropdown to show only active sales people.(1)
On the form a dropdown shows nameemp (salesperson name)
And codeslsp (salespersons initials) with a list of both active and inactive salespeople
Also: the dropdown field "SPFULLNAME" is type: name and editable and the view is ARPAS</b>
Sub Click(Source As Button)
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim workspace As New NotesUIWorkspace
Dim view As NotesView
Dim doc As NotesDocument
Dim j As Integer
Dim k As Integer
Set uidoc = workspace.currentdocument
Set currentdoc = uidoc.document
Dim Number As Integer
Number = 1
SPSHORTNAME="SALESPER"+Cstr(Number)
SPFULLNAME="SPFULLNAME"+Cstr(Number)
SALESPLT="SALESPLT"+Cstr(Number)
'Check if SALESPER is empty
If currentdoc.SPFULLNAME1(0) ="" Or currentdoc.SPFULLNAME1(0) = Null Then
Messagebox "Please type in a salesperson entry", 0, "STOP"
'uidoc.GotoField("SALESPER1")
Exit Sub
End If
'Lookup the SalesPerson
Set view = db.GetView( "ARPAS" )
'One variable to store SalesPerson Name and one to store SalesPerson Number
Dim allcustomers() As String 'SalesPerson Initials
Dim allcustomers2() As String 'SalesPerson FullName
'Prompt User to select a field to find by then do a search based on that field.
Dim count As Integer 'Used to sync array element with workspace prompt selection.
j = view.FTSearch( {field NAMEEMPL contains "}+uidoc.Fieldgettext(SPFULLNAME)+{"}, 0 )
' Messagebox {NAMEEMPL = "}+uidoc.Fieldgettext(SPFULLNAME)+{"}, 0, "STOP"
Set doc = view.GetFirstDocument
Messagebox "CODESLSP = "+Cstr(doc.CODESLSP(0)), 0, "STOP"
Redim allcustomers(j-1)
Redim allcustomers2(j-1)
For i = 0 To j-1
allcustomers(i) = doc.CODESLSP(0)
allcustomers2(i) = doc.NAMEEMPL(0)
Set doc = view.GetNextDocument(doc)
Next
Call view.Clear
Call uidoc.Refresh
End Sub