All,
A long time ago I made this thread to create a form with multiple editable records to use as a daily shift production tracker. I'm dusting it off to potentially use in another application, but I need to make it work a little better. I'm still terrible at coding however I am able to piece snippets together to achieve stuff from time to time. I've hit a brick wall in this regard.
This OnLoad procedure allows me to create multiple records for different employees.
Code:
Private Sub Form_Load()
DoCmd.GoToRecord acForm, "TEST", acNewRec
Me.Combo17 = Combo17.Column(0, 0)
DoCmd.GoToRecord acForm, "TEST", acNewRec
Me.Combo17 = Combo17.Column(0, 1)
DoCmd.GoToRecord acForm, "TEST", acNewRec
Me.Combo17 = Combo17.Column(0, 2)
DoCmd.GoToRecord acForm, "TEST", acNewRec
Me.Combo17 = Combo17.Column(0, 3)
DoCmd.GoToRecord acForm, "TEST", acNewRec
Me.Combo17 = Combo17.Column(0, 4)
DoCmd.GoToRecord acForm, "TEST", acNewRec
Me.Combo17 = Combo17.Column(0, 5)
DoCmd.GoToRecord acForm, "TEST", acNewRec
Me.Combo17 = Combo17.Column(0, 6)
DoCmd.GoToRecord acForm, "TEST", acNewRec
Me.Combo17 = Combo17.Column(0, 7)
DoCmd.GoToRecord acForm, "TEST", acNewRec
Me.Combo17 = Combo17.Column(0, 8)
DoCmd.GoToRecord acForm, "TEST", acNewRec
Me.Combo17 = Combo17.Column(0, 9)
End Sub
Which yields this form:
This allows supervisors to enter daily production hours fairly easily on one form directly into my production database. Unfortunately, it requires me to hard code in a finite amount of columns to add to the form. I want the flexibility of re-querying the form by shift and employee type which can change the amount of records to display. In the instance above, I want the form to rerun the code based on 1st Shift "Auditors", which has an employee record count of 2. It would be reduced to two records as a result and look like this:
Is there a way to do this? Maybe like some kind of if statement with a loop until the last record is reached?
Any help would be greatly appreciated!
Thanks