Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign+Filtered+Records+To+Employee

Status
Not open for further replies.

BvCF

MIS
Nov 11, 2006
92
Having some difficulty with assigning accounts to employees
using a combo box on a form.

Currently, have a listbox, lstUnassigned, on a form with a combo box with various usernames.

I just added a search feature with requery using a textbox. In other words, upon typing account number "124" in the textbox, all records with "124" shows in the listbox.

The bound column in the listbox is AccountNo.

Question - How can I assign the filtered results in the listbox to the specific employee when I use the combo box?

Thanks in advance.
 
After some research, I created a command button on the form and named it "AssignTo." In the onclick event of the command button, I have the following code;

Private Sub cmdAssignTo_Click()
Me.AssignedTo = cmbUsername.Value
Me.Date_Assigned = Date
Me.StatusCode = "Open"
DoCmd.RunSQL "Update tblAccounts " & _
"SET DateAssigned = Date(), AssignedTo = me.AssignedTo " & _
"StatusCode='Open' " & _
"Where AccountNo = '" & Me.lstUnassigned & "'"
End Sub

My logic flow is this - the manager filter the contents of the listbox, then select the employee that will be assigned to the displayed accounts, and then the manager clicks on the command button that will update the local Access table.

Am I on the right path?

Additional thought is that it might be only possible to assign an account on an individual basis by highlighting the specific record within the listbox. However, I am interested in assigning several accounts at once to a particular employee.

How would you do differently?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top