sum function


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: sum function

Hybrid View

  1. #1
    gamal Guest

    sum function


    hello

    i want to use the sum function on a filed on a table in access2000. i am
    using module. so if i type

    x=("select sum[filed_name] as [any_var] from mytable".


    Debug.Print x
    or
    Debug.Print any_var
    i get the following answer in the Immediate table like an echo

    select sum[field_name] as {any_var] from mytable

    so i have no clue how i use the sum function in sql-statement in module
    any advise will be appreciated

  2. #2
    Craig Brown Guest

    Re: sum function


    Gamal,

    Try:

    x = "Select Sum(NumericField) as CountOfStuff From tblMyTable"

    Then execute the SQL. It should return one row with the column specified
    by NumericField totaled up.

    Debug.Print x will only show you the value of x, not run the SQL. The Sum
    function, here, is run by the SQL interpreter on the database. It is not
    run by Debug.Print.

    Craig Brown

    "gamal" <gamalt@yahoo.com> wrote:
    >
    >hello
    >
    >i want to use the sum function on a filed on a table in access2000. i am
    >using module. so if i type
    >
    >x=("select sum[filed_name] as [any_var] from mytable".
    >
    >
    >Debug.Print x
    >or
    >Debug.Print any_var
    >i get the following answer in the Immediate table like an echo
    >
    >select sum[field_name] as {any_var] from mytable
    >
    >so i have no clue how i use the sum function in sql-statement in module
    >any advise will be appreciated



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center