Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / March 2006

Tip: Looking for answers? Try searching our database.

Add two fields of a query together?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andibevan - 29 Mar 2006 18:08 GMT
I am trying to add two fields from another query together in a query.  I
want to add the fields together - [qry_AB_Metrics_4].[1
Critical]+[qry_AB_Metrics_4].[2 High] but there is a problem.  If the
Critical and High values are 8 and 6 respectively - the total is 86 not 14.

How do you add two fields of a query together?

SELECT qry_AB_Metrics_4.Range, qry_AB_Metrics_4.Total,
([qry_AB_Metrics_4].[1 Critical]+[qry_AB_Metrics_4].[2 High]) AS High,
qry_AB_Metrics_4.[3 Medium] AS Medium, qry_AB_Metrics_4.[4 Low] AS Low

FROM qry_AB_Metrics_4;

TIA

Andi
Duane Hookom - 29 Mar 2006 18:14 GMT
Apparently your query qry_AB_Metrics_4 is returning the values a text. You
can wrap each field in Val() to conver to numeric.
Val([1 Critical])+Val([2 High]) As   High,

Signature

Duane Hookom
MS Access MVP
--

>I am trying to add two fields from another query together in a query.  I
> want to add the fields together - [qry_AB_Metrics_4].[1
[quoted text clipped - 13 lines]
>
> Andi
Tom Lake - 29 Mar 2006 18:16 GMT
>I am trying to add two fields from another query together in a query.  I
> want to add the fields together - [qry_AB_Metrics_4].[1
> Critical]+[qry_AB_Metrics_4].[2 High] but there is a problem.  If the
> Critical and High values are 8 and 6 respectively - the total is 86 not 14.
>
> How do you add two fields of a query together?

They are obviously text fields rather than numeric.  try this:

Val([1 Critical]) + Val([2 High])

Tom Lake
Rick B - 29 Mar 2006 18:16 GMT
Sounds like it is concatenating strings, not adding values.

The fields you are using must be text fields, not numeric.

I think you can use the "Val" function to convert them, or just fix the data
types for the fields if they should truly be numeric.

Signature

Rick B

>I am trying to add two fields from another query together in a query.  I
> want to add the fields together - [qry_AB_Metrics_4].[1
[quoted text clipped - 13 lines]
>
> Andi
Andibevan - 29 Mar 2006 18:29 GMT
'Thanks all - that did the trick.

> Sounds like it is concatenating strings, not adding values.
>
[quoted text clipped - 20 lines]
> >
> > Andi
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.