ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Multiple listings (https://www.excelbanter.com/excel-discussion-misc-queries/139477-multiple-listings.html)

IT_roofer

Multiple listings
 
I don't really know if this the right forum or how to describe what
information I'm looking for... but I'll try this first:

I have a tables for the folowing items: product types, product layers,
application methods, manufacturer names, a table named after each
manufacturer and a table with fields for manufacturer name, product type,
application method and product name. I ended up with all these tables because
I do not know how to filter out duplicate items from a query. For example:
there are 4 ways to apply "Item3". Like so...

Item1 - Apply1
Item1 - Apply2
Item2 - Apply1
Item3 - Apply1
Item3 - Apply2
Item3 - Apply3
Item3 - Apply4

However, there may be 12 different application methods and this particular
manufacturer only carries products that deal with certain methods. Clear as
mud? :) I have a query string in Excel that fetches this information and
populates a two different comboboxes in a userform. Like I said before, the
trouble is, it populates the comboboxes with EVERYTHING from the table. I
only want it to populate the comboboxes with certain information. When I tell
Excel what manufacturer to look up I only want the item list and its
application method (ie - Item1, Item2, Item3 - Apply1, Apply2, Apply4,
Apply5, Apply9) not a repeat of an Item and it's alternate application method.

As of right now, Combo2 from my userform in Excel is populated from a
mftrNames table like this:

'==== Excel Code ====
Private Sub tasklist_Change()
Dim db As Database
Dim rs1 As Recordset
Dim sysMftr As String
mftrlist.Clear
mftrlist.Text = "Select..."
Set db = OpenDatabase("\\myServer\Users\SQL\roofing.mdb")
sysMftr = "SELECT * FROM mftrNames;"
Set rs1 = db.OpenRecordset(sysMftr)
With rs1
If Not .BOF Then .MoveFirst
While Not .EOF
With mftrlist
.AddItem rs1("mftrName")
End With
.MoveNext
Wend
End With
Set rs1 = Nothing
db.Close
Set db = Nothing
End Sub

Which Works great. So my Manufacturer Combo is now populated. When I choose
a manufacturer, the query calls "SELECT * FROM " & mftrlist.Text & ";" which
_works_ but duplicates entries from the named manufacturer database... So I
guess that's the question - how do I get my query to move on to the next
record or field without repeating/missing data.

IT_roofer

Multiple listings
 
Nevermind.

I figured it out.

"IT_roofer" wrote:

I don't really know if this the right forum or how to describe what
information I'm looking for... but I'll try this first:

I have a tables for the folowing items: product types, product layers,
application methods, manufacturer names, a table named after each
manufacturer and a table with fields for manufacturer name, product type,
application method and product name. I ended up with all these tables because
I do not know how to filter out duplicate items from a query. For example:
there are 4 ways to apply "Item3". Like so...

Item1 - Apply1
Item1 - Apply2
Item2 - Apply1
Item3 - Apply1
Item3 - Apply2
Item3 - Apply3
Item3 - Apply4

However, there may be 12 different application methods and this particular
manufacturer only carries products that deal with certain methods. Clear as
mud? :) I have a query string in Excel that fetches this information and
populates a two different comboboxes in a userform. Like I said before, the
trouble is, it populates the comboboxes with EVERYTHING from the table. I
only want it to populate the comboboxes with certain information. When I tell
Excel what manufacturer to look up I only want the item list and its
application method (ie - Item1, Item2, Item3 - Apply1, Apply2, Apply4,
Apply5, Apply9) not a repeat of an Item and it's alternate application method.

As of right now, Combo2 from my userform in Excel is populated from a
mftrNames table like this:

'==== Excel Code ====
Private Sub tasklist_Change()
Dim db As Database
Dim rs1 As Recordset
Dim sysMftr As String
mftrlist.Clear
mftrlist.Text = "Select..."
Set db = OpenDatabase("\\myServer\Users\SQL\roofing.mdb")
sysMftr = "SELECT * FROM mftrNames;"
Set rs1 = db.OpenRecordset(sysMftr)
With rs1
If Not .BOF Then .MoveFirst
While Not .EOF
With mftrlist
.AddItem rs1("mftrName")
End With
.MoveNext
Wend
End With
Set rs1 = Nothing
db.Close
Set db = Nothing
End Sub

Which Works great. So my Manufacturer Combo is now populated. When I choose
a manufacturer, the query calls "SELECT * FROM " & mftrlist.Text & ";" which
_works_ but duplicates entries from the named manufacturer database... So I
guess that's the question - how do I get my query to move on to the next
record or field without repeating/missing data.



All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com