Results 1 to 4 of 4

Thread: Access/SQL

  1. #1
    Join Date
    May 2011
    Posts
    47

    Unanswered: Access/SQL

    Would appreciate help with SQL. I have insert statements as follows:

    db.Execute "INSERT INTO mytable (field_A, field_B, field_c, field_ABC) VALUES ('" & ROUND(Me.field_A.value, 0) & "',
    '" & ROUND(Me.field_B.value, 0) & "',
    '" & ROUND(Me.field_C.value, 0) & "',
    '" & ROUND(Me.field_A.value, 0) & "' +
    '" & ROUND(Me.field_B.value, 0) & "' +
    '" & ROUND(Me.field_C.value, 0) & "'"

    If fields A, B, and C are each = 111, field ABC should be = 333 (i.e. A + B + C). But instead I get 111,111,111. The values are not adding but appending text. Again, would very much appreciate help with this.

    Thanks,
    Jack Kent

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so take out the text delimiters then

    if its a numeric value you don't need to and shouldn't use a text delimiter, if its a string / text value you do need a text delimiter

    BTW you shouldn't be stroing the value of A+B+C as it can be easily derived in a query.
    storign the intermediate valeus is a recipie for disaster later on, UNLESS you are storign the value as an internal system / data check to assert that the 3 columnbs haven't changed.. but there are better ways of doing that.
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2011
    Posts
    47

    Access/SQL

    Thank you, I'll make the change.

  4. #4
    Join Date
    May 2011
    Posts
    47

    Access/SQL

    Sorry, but can you give me an example. I'm still not getting it to work.
    Thanks,
    Jack Kent

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •