ForumMember
Board Regular
- Joined
- Sep 10, 2011
- Messages
- 57
Hi all,
I have put together a table as an example of what I will be working with. What I would like ideally is:
I have included a small piece of existing code to give some idea of where I am at and how I have got there.
What I really need now is the code to do the above, an explanation of what the code is doing would be great – and crucially, how to insert the new code into the existing code so it works!
I hope that has clarified?
Purchasing.....Customer......Operator......Salesperson......Driver
Purchasing 1....Customer 1.....Operator 1....Salesperson 1.....Driver 1
Purchasing 2....Customer 2.....Operator 2....Salesperson 2.....Driver 2
Purchasing 3....Customer 3.....Operator 3....Salesperson 3.....Driver 3
Purchasing 4....Customer 4.....Operator 4....Salesperson 4.....Driver 4
Purchasing 5....Customer 5.....Operator 5....Salesperson 5.....Driver 5
Purchasing 6..........................Operator 6..............................Driver 6
Purchasing 7.......................................................................Driver 7
I have put together a table as an example of what I will be working with. What I would like ideally is:
- Each of the column headers to form an option in Combobox 1 (More will be added)
- Each of the values in the cells under the Headers to represent dependent options in Combobox 2 (these will also change, so need to comboboxes to change accordingly)
- Also, Instead of populating the existing comboboxes in the code with the “AddItem” command, I would like to reference the relevant column on the “Data Input” sheet.
I have included a small piece of existing code to give some idea of where I am at and how I have got there.
What I really need now is the code to do the above, an explanation of what the code is doing would be great – and crucially, how to insert the new code into the existing code so it works!
I hope that has clarified?
Code:
[FONT=Arial][SIZE=2][COLOR=#000000]Private Sub UserForm_Initialize()
Application.Visible = False
txtCustomer.Value = ""
txtDetails.Value = ""
txtResDetails = ""
txtDate.Value = Format(Date, "dd/mm/yyyy")
txtTime.Value = Format(Time, "hh:mm")
With cboOperator
.AddItem "Operator 1"
.AddItem "Operator 2"
.AddItem "Operator 3"
.AddItem "Operator 4"
.AddItem "Operator 5
End With
cboOperator.Value = ""
With cboIssue
.AddItem "Missing"
.AddItem "Quality"
.AddItem "Short Delivered"
.AddItem "Damaged"
.AddItem "Late"
End With
cboIssue.Value = ""
End Sub
Private Sub cmdExit_Click()
Unload Me
Application.Quit
End Sub
Private Sub cmdClear_Click()
Call UserForm_Initialize
End Sub
Private Sub cmdUnlock_Click()
If Me.txtPassword.Value = "password" Then
Unload Me
Application.Visible = True
Else
Me.Hide
Retry = MsgBox("The password is incorrect. Do you wish to try again?", vbYesNo, "Retry?")
Select Case Retry
Case Is = vbYes
Me.txtPassword.Value = ""
Me.txtPassword.SetFocus
Me.Show
Case Is = vbNo
Unload Me
End Select
End If
End Sub[/COLOR][/SIZE][/FONT]
Purchasing.....Customer......Operator......Salesperson......Driver
Purchasing 1....Customer 1.....Operator 1....Salesperson 1.....Driver 1
Purchasing 2....Customer 2.....Operator 2....Salesperson 2.....Driver 2
Purchasing 3....Customer 3.....Operator 3....Salesperson 3.....Driver 3
Purchasing 4....Customer 4.....Operator 4....Salesperson 4.....Driver 4
Purchasing 5....Customer 5.....Operator 5....Salesperson 5.....Driver 5
Purchasing 6..........................Operator 6..............................Driver 6
Purchasing 7.......................................................................Driver 7