Solved

Access Query, count records and total quantity field

Posted on 2011-09-21
8
398 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
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)

 

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

828 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