Created
April 2, 2010 14:42
-
-
Save gsherman/353197 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim listEmployees As List | |
Sub Form_Load() | |
Dim br As New Bulkretrieve | |
Dim employeeList As List | |
Dim nameList As New List | |
Dim i As Integer | |
Dim recEmplUser As Record | |
Me.DoDefault | |
br.SimpleQuery 0, "empl_user" | |
br.AppendFilter 0, "p_site", cbEqual, "Dovetail Software" | |
br.AppendSort 0, "first_name", cbAscending | |
br.RetrieveRecords | |
Set employeeList = br.GetRecordList(0) | |
'Create a list that contains employee firstName + lastName | |
nameList.ItemType = "string" | |
For i = 0 To employeeList.count - 1 | |
Set recEmplUser = employeeList.ItemByIndex(i) | |
nameList.AppendItem recEmplUser.GetField("first_name") + Space$(1) + recEmplUser.GetField("last_name") | |
Next i | |
'Fill this list into the contextual object that is set as the source of the drop-down list | |
cobj_list_employee.Fill nameList | |
'Save this list of employees into a module (form) level variable | |
Set listEmployees = employeeList | |
End Sub | |
Sub go_Click() | |
Dim employeeName As String | |
Dim index As Integer | |
Dim recEmplUser As Record | |
employeeName = ddl_employee.Selected | |
MsgBox "The employee selected in the drop down is: " & employeeName | |
index = ddl_employee.ListIndex | |
MsgBox "The selected index in the drop down is: " & cstr(index) | |
'Get the employee/user record from the module(form) level variable that we saved earlier | |
Set recEmplUser = listEmployees.ItemByIndex(index) | |
MsgBox "login name of the selected user: " + recEmplUser.GetField("login_name") | |
MsgBox "employee objid of the selected employee: " + CStr(recEmplUser.GetField("employee")) | |
End Sub | |
Sub Done_Click() | |
Me.Close | |
End Sub | |
Public Sub Message(ByVal num As Long, ByVal info As String) | |
Select Case num | |
Case cbCloseMessage | |
Me.Close cbCloseChildren | |
Case Else | |
Me.DoDefault | |
End Select | |
End Sub | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment