Drop down menu to pull certain data from table

I hope someone can help me with a piece of Lotusscript.The code pulls names from a database that are both active or inactive in accordance with another table. I am trying to get the dropdown on the form to just show the active sales people. Thank you in advance for any help

In a nutshell:

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

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

Thank you in advance for any help!

Subject: Drop down menu to pull certain data from table

how about creating a view that only shows active salesman and the do a @dbcolum to get your list?

Subject: RE: Drop down menu to pull certain data from table

The dropdown is on a heavily-used form and the change needs to reflect in the dropdown on that form.