Using combo box values in a loop

Serious Sam

New Member
Joined
Jan 19, 2005
Messages
30
Hello,

I have a Timesheet database and I'm trying to build a function that allows
a batch of timesheets to be produced with the click of a button.

The process goes like this:
1. A form has a text box where the WeekEnding Date is entered.
2. The form also has a combo box where the Departments are listed.
3. When a Department is selected, another combo box is re-queried and lists the Employees in that department.
4. A command button then opens a timecard form. This is where the hours and allowances are entered.
I've got an auto-populate function that puts the standard hours for the selected employee into the form.
(Thanks to Denis the SydneyGeek, for showing me how to get the auto-populate to work when the form is opened.)

The next step I'm working on is to use the values listed in the Employee combo box value and get them one by one into the Employee input box of the timecard form, so the following happens:

1. Create a new timecard with the first person from the Employee combo
2. Run the autopopulate function for that employee
3. Create a new timecard with the next person from the Employee combo
4. Run the autopopulate for that employee
...and so on for all people listed in the Employee combo.

Can anyone help get combo box items into a form text box?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

MyBoo

Board Regular
Joined
Aug 9, 2006
Messages
217
Can anyone help get combo box items into a form text box?
Me!FormTextBox1 = Me!EmpCombo.column(0)
Me!FormTextBox2 = Me!EmpCombo.column(1)

If your intention is to auto-populate the timecards for each Employee in the selected Department.... why do you need the Employee Combo box?

You could create a recordset, pulling Employee information, based on the selected Department. Then loop through each new timecard, feeding Employee data from the recordset.
 

Forum statistics

Threads
1,136,878
Messages
5,678,300
Members
419,753
Latest member
Sallylwy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top