Solved

Access Query, count records and total quantity field

Posted on 2011-09-21
8
396 Views
Last Modified: 2012-05-12
i asked this question Monday:

I have a Access table that lists the jobs that we have placed a bid on in the last year and the number of hours that we bid.  I need to count the number of jobs, count the number of jobs that we have been awarded (award date is filled in) and the total number of hours that we have bid on all the jobs.  How can i do this?

and got this response:   SELECT Count(tbltotalspas.[CPP #]) AS [CountOfCPP #], Sum(IIf([DATE CONTRACT AWARD] Is Null,0,1)) AS NoOfContractAwarded, Sum(tbltotalspas.[TOTAL HOURS BID]) AS [SumOfTOTAL HOURS BID], Sum(tbltotalspas.[TOTAL ACTUALS]) AS [SumOfTOTAL ACTUALS]
FROM tbltotalspas;
 but when i click on the "run" button i get this error message:  Data type mismatch in criteria expression.  

Can anyone tell me what to change?  i have tried a couple of things but so far i haven't been able to get it to work.

thanks
0
Comment
Question by:barnescs
  • 4
  • 3
8 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 36576269
check your table  tbltotalspas and compare it with the table from this thread

http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_27304035.html#a36525997

0
 

Author Comment

by:barnescs
ID: 36576371
i took and copied everything from that thread in case i had some punctuation or spacing errors and i still got the mismatch error.
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 36576490
upload the db your are working on.
0
 

Author Comment

by:barnescs
ID: 36576651
OK, here it is........... spares-proposal-data---Copy.accdb
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36576754
Can you post the explicit steps to see this issue?

I am not finding a "Run" button on any of your forms...
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 36576772
run this update query first

UPDATE tbltotalspas SET tbltotalspas.[TOTAL HOURS BID] = Null
WHERE (((IsNumeric([TOTAL HOURS BID]))=0));



then run Query1

SELECT Count(tbltotalspas.[CPP #]) AS [CountOfCPP #], Sum(IIf([DATE CONTRACT AWARD] Is Null,0,1)) AS NoOfContractAwarded, Sum(tbltotalspas.[TOTAL HOURS BID]) AS [SumOfTOTAL HOURS BID], Sum(tbltotalspas.[TOTAL ACTUALS]) AS [SumOfTOTAL ACTUALS]
FROM tbltotalspas





0
 

Author Comment

by:barnescs
ID: 36576794
your telling me that i have to convert the "total hours bid" column into a number field instead of a text field and then the query will work?  is that correct?
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 36576849
<your telling me that i have to convert the "total hours bid" column into a number field instead of a text field and then the query will work?>

Yes that is one way of preventing unwanted characters in the field.

right now, the field  "total hours bid" contains  "-" and zero length string
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now