round function

  • Hi people.

    i have a strange situation.

    I i try to use this string "select round(qta,2) From (Select sum(movmag.qtamov*movmag.fatqta) as qta from " in access query and all is work right.

    I try to use it in a vb 6.0 program with dao connection Microsoft jet 4.0 and i have a error "expression 'round' not valid"

    someone can help me ???????

    regards

    Alberto.

  • I have no idea!!!

  • Hi,

    I've seen this before, try the CINT() function.

    Not 100% sure what the reason for it not working was now but I believe it's because Round function is not a valid JET engine function. The SQL syntax is different between the two.

    Hope that helps.

    Lewis

  • Alberto.Omini

    If you are going to continue using VB 6 to query a SQL Server database, update the application to use ADO in place of DAO. Now here some test data and the query string for use with a SQL Server data base.

    CREATE TABLE #TestBal(

    [Sr] [int] NOT NULL,

    [Credit] DECIMAL(10,2) NOT NULL,

    [Debit] [INT] NOT NULL,

    [Balance] DECIMAL(10,2) NOT NULL)

    INSERT INTO #TestBal

    SELECT 1,2.5,3,4.44 UNION ALL

    SELECT 10,20.25,30,40.01 UNION ALL

    SELECT 100,200.99,300,400.01

    --Test different rounding values

    Select Sr,ROUND(sum(Credit*Balance),2) as qta from dbo.#TestBal GROUP BY Sr

    Select Sr,ROUND(sum(Credit*Balance),4) as qta from dbo.#TestBal GROUP BY Sr

    Select Sr,sum(Credit*Balance) as qta from dbo.#TestBal GROUP BY Sr

    DROP TABLE #TestBal

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • fuma75 (10/27/2009)


    I have no idea!!!

    LOL :laugh:

    I am pretty sure he wasn't asking you specifically! 😉

    -Supriya

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply