Hi
I am having problems with this code. can anybody spot the problem. i am trying to get employee names into a list on my form. thats it!!!! don't know why it doesn't work.
btw, what i am really trying to do is get a field "employee" which includes first and last name to be split up. can anybody tell me the easiest way to use the split function. i want that the user should be able to search and sort last names as well as first names.
thanks,
sam
following is my code.
Private Sub Form_Open(Cancel As Integer)
Dim rs As ADODB.Recordset
Dim strMySQL As String
On Error Resume Next
Set rs = New Recordset
strMySQL = "SELECT AgencyLogTbl.EmployeeName As Emp FROM AgencyLogTbl" & _
" WHERE AgencyLogTbl.EmployeeName Is Not Null"
rs.Open strMySQL, CurrentProject.Connection
rs.MoveFirst
Do While rs!Emp
If Not IsNull(rs!EmployeeName) Then
ListName.AddItem rs!Emp
End If
rs.MoveNext
Loop
Set rs = Nothing
End Sub
I am having problems with this code. can anybody spot the problem. i am trying to get employee names into a list on my form. thats it!!!! don't know why it doesn't work.
btw, what i am really trying to do is get a field "employee" which includes first and last name to be split up. can anybody tell me the easiest way to use the split function. i want that the user should be able to search and sort last names as well as first names.
thanks,
sam
following is my code.
Private Sub Form_Open(Cancel As Integer)
Dim rs As ADODB.Recordset
Dim strMySQL As String
On Error Resume Next
Set rs = New Recordset
strMySQL = "SELECT AgencyLogTbl.EmployeeName As Emp FROM AgencyLogTbl" & _
" WHERE AgencyLogTbl.EmployeeName Is Not Null"
rs.Open strMySQL, CurrentProject.Connection
rs.MoveFirst
Do While rs!Emp
If Not IsNull(rs!EmployeeName) Then
ListName.AddItem rs!Emp
End If
rs.MoveNext
Loop
Set rs = Nothing
End Sub