Solved

Access query with multiple fields

Posted on 2008-06-12
3
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
brad2575 earned 125 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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

627 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