Search by User_Name with combobox
Ok, I made a form to search by a User_Name within the database. I tried to use the same methods as the one that I made with a "Search by Status" however, I just can't figure out why it's not working. The form is pretty much the same visually. One combo box, UserName, one list box, ListUser.
I'm trying to make it so that the User_Name from the database shows in the combo box, got that to work ok. However, I'm trying to return the results from a query, code to follow, into the list box showing the following four "headers" within the listbox: Task_ID, Task_Description, Date_Originated, Status.
The code on the form is:
Option Compare Database
Private Sub Combo12_AfterUpdate()
'This is the combo box for the user to select the name they want to search by for user_name
Me.ListUser.RowSource = "qryUserName"
End Sub
Private Sub ListUser_AfterUpdate()
'this is the double-click event to open the task to be viewed or edited
Dim intTaskID As Integer
intTaskID = Me!ListUser
DoCmd.Close acForm, "frmSearchUserName"
DoCmd.OpenForm "frmTask", , , "[Task_ID] = " & intTaskID & ""
End Sub
Private Sub List9_AfterUpdate()
'this is the double-click event to open the task to be viewed or edited
End Sub
Private Sub ListUser_BeforeUpdate(Cancel As Integer)
End Sub
The query has the following:
Fields: Task_ID, User_Name, Task_Description, Status, Date_Orginated
Criteria under "User_Name" is: Like [Forms]![frmSearchUserName]![UserName] & "*"
Any ideas on why it won't work? I'm working on it but can't figure it out. It all looks the same as the "Search by Status" form, even the query.
|