Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access query with multiple fields

Posted on 2008-06-12
3
Medium Priority
?
240 Views
Last Modified: 2010-03-20
OK I'm trying to make a query in access that will list the results for different UPCs. Right now I paste the upc in a text field (Tect2) and it will list the result. I want to know in access is there a way to list the result for multiple UPCs. Here's the sql code that I use now:

SELECT Superfile.LabelStudioAbbr, Superfile.CatalogNumber, Superfile.ArtistName, Superfile.ItemTitle, Superfile.LabelStudioName, Superfile.UPC, Superfile.ConfigNumber
FROM Superfile
GROUP BY Superfile.LabelStudioAbbr, Superfile.CatalogNumber, Superfile.ArtistName, Superfile.ItemTitle, Superfile.LabelStudioName, Superfile.UPC, Superfile.ConfigNumber
HAVING (((Superfile.UPC)=[Form1]![Tect2]));

I would like to know how to search for multiplt UPCs here's two for example:
715515009621 and 715515010429

Thanks,
Chad
0
Comment
Question by:taunt
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
brad2575 earned 375 total points
ID: 21772570
You could just change the having to a where and use an OR
SELECT Superfile.LabelStudioAbbr, Superfile.CatalogNumber, Superfile.ArtistName, Superfile.ItemTitle, Superfile.LabelStudioName, Superfile.UPC, Superfile.ConfigNumber
FROM Superfile
GROUP BY Superfile.LabelStudioAbbr, Superfile.CatalogNumber, Superfile.ArtistName, Superfile.ItemTitle, Superfile.LabelStudioName, Superfile.UPC, Superfile.ConfigNumber
WHere (((Superfile.UPC)=[Form1]![Tect2])) OR (((Superfile.UPC)=[Form1]![Tect2])); 

Open in new window

0
 

Author Comment

by:taunt
ID: 21772749
It worked I thought I tried that but looks like I did something wrong. How could I do it with large queries (over 1000) UPCs.

Thanks
0
 
LVL 16

Expert Comment

by:brad2575
ID: 21792450
Do you mean 1000 different form items?  Then you would just change it to use an Where "IN" Statmenet.  SO it would look like this:

 and just keep adding the form fields on inside the "IN" Statement.  Or save all the form fields into a temp table and do an in statement on the temp table like the second query below
SELECT Superfile.LabelStudioAbbr, Superfile.CatalogNumber, Superfile.ArtistName, Superfile.ItemTitle, Superfile.LabelStudioName, Superfile.UPC, Superfile.ConfigNumber
FROM Superfile
GROUP BY Superfile.LabelStudioAbbr, Superfile.CatalogNumber, Superfile.ArtistName, Superfile.ItemTitle, Superfile.LabelStudioName, Superfile.UPC, Superfile.ConfigNumber
WHere (Superfile.UPC IN ([Form1]![Tect2], [Form1]![Tect2], [Form1]![Tect2])); 
 
 
 
SELECT Superfile.LabelStudioAbbr, Superfile.CatalogNumber, Superfile.ArtistName, Superfile.ItemTitle, Superfile.LabelStudioName, Superfile.UPC, Superfile.ConfigNumber
FROM Superfile
GROUP BY Superfile.LabelStudioAbbr, Superfile.CatalogNumber, Superfile.ArtistName, Superfile.ItemTitle, Superfile.LabelStudioName, Superfile.UPC, Superfile.ConfigNumber
WHere (Superfile.UPC IN (Select UPC From TempTableNameHere)) ; 

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question