J
Jaybird
Dear All,
With some help from John Spencer I've come up with a query that does exactly
what I want... except that when I use it as the row source for my combo box
in a form, I cannot select the specific record I want. I'm guessing that my
selection criteria aren't specific enough, but I'm unsure of how to go about
fixing it.
Here's my SQL:
SELECT [Order Entry].[Order Number], Contacts.CompanyName, [Order
Entry].[Material Spec:], [Order Entry].Alloy, [Order Entry].[Thick 1] as
[Thick], [Order Entry].[Part Number1] AS [Part Number], [Order Entry].[QTY 1]
AS QTY
FROM Contacts INNER JOIN [Order Entry] ON Contacts.ContactID = [Order
Entry].ContactID
WHERE ((([Order Entry].[Part Number1]) Is Not Null))
UNION SELECT [Order Entry].[Order Number], Contacts.CompanyName, [Order
Entry].[Material Spec:], [Order Entry].Alloy, [Order Entry].[Thick 2] as
[Thick], [Order Entry].[Part Number 2] AS [Part Number], [Order Entry].[QTY2]
AS QTY
FROM Contacts INNER JOIN [Order Entry] ON Contacts.ContactID = [Order
Entry].ContactID
WHERE ((([Order Entry].[Part Number 2]) Is Not Null))
UNION SELECT [Order Entry].[Order Number], Contacts.CompanyName, [Order
Entry].[Material Spec:], [Order Entry].Alloy, [Order Entry].[Thick 3] as
[Thick], [Order Entry].[Part Number 3] AS [Part Number], [Order Entry].[QTY
3] AS QTY
FROM Contacts INNER JOIN [Order Entry] ON Contacts.ContactID = [Order
Entry].ContactID
WHERE ((([Order Entry].[Part Number 3]) Is Not Null))
UNION SELECT [Order Entry].[Order Number], Contacts.CompanyName, [Order
Entry].[Material Spec:], [Order Entry].Alloy, [Order Entry].[Thick 4] as
[Thick], [Order Entry].[Part Number1] AS [Part Number], [Order Entry].[QTY4]
AS QTY
FROM Contacts INNER JOIN [Order Entry] ON Contacts.ContactID = [Order
Entry].ContactID
WHERE ((([Order Entry].[Part Number4]) Is Not Null))
ORDER BY [order entry].[order number];
What this does is combine the contents of four fields from a table, ignoring
nulls, ordered by [Order Number]. I'm guessing that my combobox is only
looking for results that match the Order Number I select and ignores the fact
that I'm looking for a unique record. How can I do this?
With some help from John Spencer I've come up with a query that does exactly
what I want... except that when I use it as the row source for my combo box
in a form, I cannot select the specific record I want. I'm guessing that my
selection criteria aren't specific enough, but I'm unsure of how to go about
fixing it.
Here's my SQL:
SELECT [Order Entry].[Order Number], Contacts.CompanyName, [Order
Entry].[Material Spec:], [Order Entry].Alloy, [Order Entry].[Thick 1] as
[Thick], [Order Entry].[Part Number1] AS [Part Number], [Order Entry].[QTY 1]
AS QTY
FROM Contacts INNER JOIN [Order Entry] ON Contacts.ContactID = [Order
Entry].ContactID
WHERE ((([Order Entry].[Part Number1]) Is Not Null))
UNION SELECT [Order Entry].[Order Number], Contacts.CompanyName, [Order
Entry].[Material Spec:], [Order Entry].Alloy, [Order Entry].[Thick 2] as
[Thick], [Order Entry].[Part Number 2] AS [Part Number], [Order Entry].[QTY2]
AS QTY
FROM Contacts INNER JOIN [Order Entry] ON Contacts.ContactID = [Order
Entry].ContactID
WHERE ((([Order Entry].[Part Number 2]) Is Not Null))
UNION SELECT [Order Entry].[Order Number], Contacts.CompanyName, [Order
Entry].[Material Spec:], [Order Entry].Alloy, [Order Entry].[Thick 3] as
[Thick], [Order Entry].[Part Number 3] AS [Part Number], [Order Entry].[QTY
3] AS QTY
FROM Contacts INNER JOIN [Order Entry] ON Contacts.ContactID = [Order
Entry].ContactID
WHERE ((([Order Entry].[Part Number 3]) Is Not Null))
UNION SELECT [Order Entry].[Order Number], Contacts.CompanyName, [Order
Entry].[Material Spec:], [Order Entry].Alloy, [Order Entry].[Thick 4] as
[Thick], [Order Entry].[Part Number1] AS [Part Number], [Order Entry].[QTY4]
AS QTY
FROM Contacts INNER JOIN [Order Entry] ON Contacts.ContactID = [Order
Entry].ContactID
WHERE ((([Order Entry].[Part Number4]) Is Not Null))
ORDER BY [order entry].[order number];
What this does is combine the contents of four fields from a table, ignoring
nulls, ordered by [Order Number]. I'm guessing that my combobox is only
looking for results that match the Order Number I select and ignores the fact
that I'm looking for a unique record. How can I do this?