Synchronizing a combo box with a command button or navigation button

Shar123

New member
Local time
Today, 08:26
Joined
Aug 10, 2007
Messages
5
I really need some help. I built a form that has a combo box as a search item. The combo box (drop down box) contains the employee's last name. The goal is for the use to come to the form and choose an employees name from list and then the employee's compensation information will populate in the other fields. Now I wanted to get fancy and add command buttons at the bottom of my page so i added a next button and previous record button. However, when I hit the button to tell the form to go to the next record, the information in all of fields changes except for the employee name which is in the combo box. So basically, I need to the combo box (which contains the emp name) to be in sync with the command/navigation buttons.

how do I do this?
 
So basically, I need to the combo box (which contains the emp name) to be in sync with the command/navigation buttons.
You have said that the rest of your form controls carry to the next record information when you hit the "next button". They do this if the control source property is set to the table's corresponding field. I am guessing the combo box's property is not the same as the rest of these. Is your form based on the table?? Or did you create a form from design??

If you're using say, an autoform, try changing the combo field's "lookup" tab to "combo box" instead of text box in the table's design view. Then add that field to your form.

You didn't say that you have auto-populating going on right now. Here is the Microsoft Article on this subject.
 
I'm guessing your combo is an unbound control used to navigate to particular employees?

I've done this by using the on-current event of the form to change the value in the combo box to match the appropriate value in the current record.
So, something like
Private Sub Form_Current()
Me.Combo5 = Me.EmployeeName
End Sub

Now, if your combo stores the pk of your employee table while displaying the name (first column hidden), you set the combo value to match the pk like

Private Sub Form_Current()
Me.Combo5 = Me.EmployeeID
End Sub
 
Hi,

Thanks for your response. The form is actually based on a table but I did design it myself only using the fields from that particular table. I hope this helps to answer your question. My search field was also created from a combo box using the combo box wizard....do you suggest anything different if this doesn't work....

and yes, all of the other information on the record moves but the combo box is the only field that remains the same. For example, if I choose Jane Doe as employee and her info populates. If I then, hit the next record button, the next employee's info on the table will appear, however, Jane Doe's name will remain in the search/combo box.

You have said that the rest of your form controls carry to the next record information when you hit the "next button". They do this if the control source property is set to the table's corresponding field. I am guessing the combo box's property is not the same as the rest of these. Is your form based on the table?? Or did you create a form from design??

If you're using say, an autoform, try changing the combo field's "lookup" tab to "combo box" instead of text box in the table's design view. Then add that field to your form.

You didn't say that you have auto-populating going on right now. Here is the Microsoft Article on this subject.
 
Ahh! That sounds about right...I will try this instead as my combo box is definitely an unbound control.....Thanks again...


I'm guessing your combo is an unbound control used to navigate to particular employees?

I've done this by using the on-current event of the form to change the value in the combo box to match the appropriate value in the current record.
So, something like
Private Sub Form_Current()
Me.Combo5 = Me.EmployeeName
End Sub

Now, if your combo stores the pk of your employee table while displaying the name (first column hidden), you set the combo value to match the pk like

Private Sub Form_Current()
Me.Combo5 = Me.EmployeeID
End Sub
 

Users who are viewing this thread

Back
Top Bottom