Access 2003 Query not totalling simliar data

Posted on 2014-03-24
Last Modified: 2015-07-30
I am using the following query:

SELECT tMain.FrameLine, tMain.FrameModel, Count(tMain.FrameModel) AS CountOfFrameModel, tMain.FrameOWF
FROM tMain
WHERE (((tMain.Office)=[Forms]![FReportSelect]![LocSelect]) AND ((tMain.FrameLine)=[Forms]![FReportSelect]![cFrameLine]) AND ((tMain.FrameOWF)=False) AND ((tMain.Status)<>"Cancelled")) OR (((tMain.FrameLine)=[Forms]![FReportSelect]![cFrameLine]) AND ((tMain.FrameOWF)=False) AND ((tMain.Status)<>"Cancelled") AND (([Forms]![FReportSelect]![LocSelect])="ALL"))
GROUP BY tMain.FrameLine, tMain.FrameModel, tMain.FrameOWF, tMain.Status
ORDER BY tMain.FrameModel;

Open in new window

For the most part its pulling up data correctly but for some reason it is not grouping on the same model.  Its not doing it for all models but just some times.  I can't figure out why given its the same exact model.

Is there anyting in the SQL that might be causing this?

Thank you.
Question by:thandel
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
  • 3
  • 3
  • 2

Expert Comment

ID: 39950991
if you select DISTINCT models, do you get repeating rows that look similar?
LVL 11

Expert Comment

ID: 39951085
You are also grouping by tMain.Status, but not displaying it... this would affect groupings

Author Comment

ID: 39952391

Coachman, using distinct didn't have any change in results

John, I set status to be displayed but didn't have any change in results either.
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.


Expert Comment

ID: 39954921
My reason for using DISTINCT was to identify the reason for multiple models.
if you select DISTINCT models, do you get repeating models that look similar?
only select models, no other fields, and see if there are multiple instances of similar models.

Author Comment

ID: 39955039
If I follow your question, when selecting distinct the results are multipul models on the report of the same exact model in the querry.

For example of the model "BOTTLE ROCKET 40" I am getting one row in the query with a countofframemodel of 1 and in another row with model "BOTTLE ROCKET 40" with a countofframemodel of 3.

They are both exactly the same model.

In the query I have some models with a  count of 6 but are only on a single row.

Expert Comment

ID: 39955065
I dont understand what you are saying. The query I suggested had one field - model; no counts etc.
Maybe attach an xls with the results so I can see.
LVL 11

Accepted Solution

John_Vidmar earned 500 total points
ID: 39956688
He probably wants to know how clean is your data-field, i.e., do you have trailing spaces in model:

SELECT DISTINCT '#' + FrameModel + '#' FROM tMain

Author Comment

ID: 39957771
Thank you, the valaues entered are trimmed. I would attach a query but now when I run the issue is gone?????

Not sure how to proceed now, or why is behaving differently.  Odd, a repair is run daily... still seems OK this morning.  What is the best way to close / issue points on this?

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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. …
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

732 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