Coding and printing for combo selections on a form

karmacable

Registered User.
Local time
Today, 06:05
Joined
Sep 13, 2011
Messages
32
Here’s what I’ve got and what I’m trying to accomplish;

Group 1___Group 2____Group 3___Group 4
Sony______ Panasonic ___N/A _________N/A
Sony______N/A__________N/A_________N/A
N/A_______Sony_________N/A_________N/A
Nikon______Sony_________Panasonic____N/A
N/A_______Sony_________Nikon________N/A

So the above camera choices show up as combo boxes (looking up from another table) on the form. They save the choices by their lookup ID in the current form's corresponding fields. Also, the fields are 'not' relational between both tables, which is why querying won't work. I've done it this way for a very specific reason (discovering through much trial and error), so please don't worry about giving me advice on joining the tables and not needing to save the choices to fields.

I now have a bunch of fields in a single record which I need to do a search across to make summations for an executive report. So for the above project, the end result would be;

Group 1 has
2 x Sony
1 x Nikon
Group 2 has
3 x Sony
1 x Panasonic
Group 3 has
1 x Panasonic
1 x Nikon

All Groups 4 x Sony & 2 Panasonic & 2 Nikon

Since all this information is presented on the form, I’m looking to create a command button where once all the combo box choices have been made, a user can simply click and the above summary will be created. I’m so far looking at coding as being the solution, but can’t quite figure out the logic / syntax to make it work. Below is how I think it would work. NOTE: The following should be obvious, but it is NOT actual VBA code, simply a combination of what little I know and my descriptions of what I wish to accomplish;

Dim Variablecbo1 As String
Dim Variablecbo2 As String
(etc. for all 20)

If combobox1 has a value (or is Not Null) Then
The contents of combobox 1.column(1) = Variablecbo1
ElseIf combobox2 has a value (or is Not Null) Then
The contents of combobox2.column(1) = Variablecbo2
(Repeat until all 20 comboboxes have been looked at)


For Variablecbo1 to Variablecbo20
check for any duplicates
If you find duplicates Then
Count their total and list the item
And list everything else as 1 item
Else if there are no duplicates
List all items as 1 item
EndIf

The list part is something I’m also not quite sure how to accomplish in Access. I just want the items to populate a simple line by line format, whether in a large text box or some kind of spreadsheet row format. Let me know if I'm even going about this the right way, welcom suggestions.

Thanks for any help!
 

Users who are viewing this thread

Back
Top Bottom