L
Lauren H
I am using a combo box to lookup employee information stored in a LARGE
table. This combo box autofills numerous items on my form and gives me
information about the selected employee. This is the code I am using on the
combo box:
Private Sub search_employee_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[person_id] = '" & Me![Search_Employee] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
This works great! The problem is that I have created a subform (accessed
through a command button on this form) used to UPDATE information. One of
the options to update is to change the employee. When I change the employee
on the subform, I want the combo box to look up the new employee and display
the information on the main form.
I CAN GET THE NAME TO APPEAR IN THE COMBO BOX, BUT I CAN'T MAKE THE SELECTED
EMPLOYEE'S INFORMATION APPEAR ON THE MAIN FORM. URGH!
Here is the code I am using to send the name to the combo box:
Private Sub Command49_Click()
Dim sqlupdaterecord As String
sqlupdaterecord = "UPDATE Tbl_Cases SET Case_Name = '" & Me.newcasename &
"', "
sqlupdaterecord = sqlupdaterecord & "PersonID = '" & Me.newemployee & "', "
sqlupdaterecord = sqlupdaterecord & "WHERE CaseID = " & Me.CaseID
Dim db As DAO.Database
Set db = CurrentDb
db.Execute (sqlupdaterecord)
MsgBox "Case details updated successfully.", vbInformation, "Case Management"
[Forms]![WS_Case_Management]![Search_Advisor].Value = Me.newemployee
[Forms]![WS_Case_Management].SetFocus
DoCmd.Close acForm, "Case_Management_Edit_Case_Details", acSaveNo
[Forms]![WS_Case_Management]![Case_Management_Cases_Subform].Requery
End Sub
Any help that anyone can offer would be GREATLY appreciated!! Thanks!!
table. This combo box autofills numerous items on my form and gives me
information about the selected employee. This is the code I am using on the
combo box:
Private Sub search_employee_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[person_id] = '" & Me![Search_Employee] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
This works great! The problem is that I have created a subform (accessed
through a command button on this form) used to UPDATE information. One of
the options to update is to change the employee. When I change the employee
on the subform, I want the combo box to look up the new employee and display
the information on the main form.
I CAN GET THE NAME TO APPEAR IN THE COMBO BOX, BUT I CAN'T MAKE THE SELECTED
EMPLOYEE'S INFORMATION APPEAR ON THE MAIN FORM. URGH!
Here is the code I am using to send the name to the combo box:
Private Sub Command49_Click()
Dim sqlupdaterecord As String
sqlupdaterecord = "UPDATE Tbl_Cases SET Case_Name = '" & Me.newcasename &
"', "
sqlupdaterecord = sqlupdaterecord & "PersonID = '" & Me.newemployee & "', "
sqlupdaterecord = sqlupdaterecord & "WHERE CaseID = " & Me.CaseID
Dim db As DAO.Database
Set db = CurrentDb
db.Execute (sqlupdaterecord)
MsgBox "Case details updated successfully.", vbInformation, "Case Management"
[Forms]![WS_Case_Management]![Search_Advisor].Value = Me.newemployee
[Forms]![WS_Case_Management].SetFocus
DoCmd.Close acForm, "Case_Management_Edit_Case_Details", acSaveNo
[Forms]![WS_Case_Management]![Case_Management_Cases_Subform].Requery
End Sub
Any help that anyone can offer would be GREATLY appreciated!! Thanks!!