accvbalearner
Registered User.
- Local time
- Today, 17:25
- Joined
- Jan 3, 2013
- Messages
- 42
Hello All,
I'm hoping someone out there can point me in the right direction. I don't know exactly what question to ask, because I don't know the correct terminology to use......I Think! So I will explain a little bit and may be someone can figure out why I mean!
Ok, I have an Access Form that has User Entered (or select from a Calendar) box, two Comboboxes and two multi-select list boxes and a User Entered box for a number.
What I want to have happen: User opens the Form, enters the date, selects something from the two comboboxes, selects what ever they want in the two multi-select list boxes and enter a number. Then the User clicks a button, and what they entered and selected is passed into a table, with the date entered, the combobox selections, the number entered and the multi-select choices.
For example:
User Enters today 10-Feb-20
Combo1: BR549
Combo2: CompanyA
List1 selects: Bob, Pam, Tina
List2 selects: Miami, Orlando, Atlanta, Jackson
Number Entered: 1
Table Result
I have a form that already does this with ONE Multi-select Listbox, but not two, and being a Newbie I don't understand how to incorporate a For Next inside of the For Next, or even if I need to. Here is the code I'm using:
I hope what I'm asking is coming through and that it isn't as clear as MUD!
Thanks in advance for any help one of you Wizards out there can provide!
Take Care,
accvbalearner
I'm hoping someone out there can point me in the right direction. I don't know exactly what question to ask, because I don't know the correct terminology to use......I Think! So I will explain a little bit and may be someone can figure out why I mean!
Ok, I have an Access Form that has User Entered (or select from a Calendar) box, two Comboboxes and two multi-select list boxes and a User Entered box for a number.
What I want to have happen: User opens the Form, enters the date, selects something from the two comboboxes, selects what ever they want in the two multi-select list boxes and enter a number. Then the User clicks a button, and what they entered and selected is passed into a table, with the date entered, the combobox selections, the number entered and the multi-select choices.
For example:
User Enters today 10-Feb-20
Combo1: BR549
Combo2: CompanyA
List1 selects: Bob, Pam, Tina
List2 selects: Miami, Orlando, Atlanta, Jackson
Number Entered: 1
Table Result
ID | Date | Combo1 | Combo2 | List1 | List2 | Number |
---|---|---|---|---|---|---|
1 | 10-Feb-20 | BR549 | CompanyA | Bob | Miami | 1 |
2 | 10-Feb-20 | BR549 | CompanyA | Bob | Orlando | 1 |
3 | 10-Feb-20 | BR549 | CompanyA | Bob | Atlanta | 1 |
4 | 10-Feb-20 | BR549 | CompanyA | Bob | Jackson | 1 |
5 | 10-Feb-20 | BR549 | CompanyA | Pam | Miami | 1 |
6 | 10-Feb-20 | BR549 | CompanyA | Pam | Orlando | 1 |
7 | 10-Feb-20 | BR549 | CompanyA | Pam | Atlanta | 1 |
8 | 10-Feb-20 | BR549 | CompanyA | Pam | Jackson | 1 |
9 | 10-Feb-20 | BR549 | CompanyA | Tina | Miami | 1 |
10 | 10-Feb-20 | BR549 | CompanyA | Tina | Orlando | 1 |
11 | 10-Feb-20 | BR549 | CompanyA | Tina | Atlanta | 1 |
12 | 10-Feb-20 | BR549 | CompanyA | Tina | Jackson | 1 |
I have a form that already does this with ONE Multi-select Listbox, but not two, and being a Newbie I don't understand how to incorporate a For Next inside of the For Next, or even if I need to. Here is the code I'm using:
Code:
Private Sub btn_AddWONbrs_Click()
' This button will add selected Work Order Numbers to a table
' alongwith the selected Job Number and Report Number.
Dim db As Database
Dim rs As Recordset
Dim strsel_JNbr As String
Dim strsel_RNbr As String
Dim var_WONbr As Variant
Set db = CurrentDb()
Set rs = db.OpenRecordset("RNWONbrs", dbOpenDynaset, dbSeeChanges)
strsel_JNbr = Inclsel_JNbr()
strsel_RNbr = Inclsel_RNbr()
For Each var_WONbr In sel_WONbr.ItemsSelected()
rs.AddNew
rs!WONbr = sel_WONbr.ItemData(var_WONbr)
rs!JobNbr = strsel_JNbr
rs!RepNbr = strsel_RNbr
rs.Update
Next
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
I hope what I'm asking is coming through and that it isn't as clear as MUD!
Thanks in advance for any help one of you Wizards out there can provide!
Take Care,
accvbalearner