Solved

Access Query, count records and total quantity field

Posted on 2011-09-21
8
397 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 36576490
upload the db your are working on.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:barnescs
ID: 36576651
OK, here it is........... spares-proposal-data---Copy.accdb
0
 
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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

772 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