Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access Query, count records and total quantity field

Posted on 2011-09-21
8
Medium Priority
?
407 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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

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 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

916 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