Results 1 to 4 of 4
  1. #1
    sal21 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    3

    query work in Access IDE but not in SQL string vb 6.0

    Code:
    UPDATE ANAGRAFICA SET ANAGRAFICA.TOT_ASS = TOT_ASS+DSum("IMP_ASS","VERS_ASSEGNI","RAPPORTO='" & RAPPORTO & "'");
    this query work in Acces IDE, but in SQL="UPDATE ANAGRAFICA SET ANAGRAFICA.TOT_ASS = TOT_ASS+DSum("IMP_ASS","VERS_ASSEGNI","RAPPORTO='" & RAPPORTO & "'")" have error:


    "Dsum not recognized in ... ecc...)
    Why?

    Have a similar solution.
    Tkx.

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,991
    Quote Originally Posted by sal21 View Post
    Code:
    UPDATE ANAGRAFICA SET ANAGRAFICA.TOT_ASS = TOT_ASS+DSum("IMP_ASS","VERS_ASSEGNI","RAPPORTO='" & RAPPORTO & "'");
    this query work in Acces IDE, but in SQL="UPDATE ANAGRAFICA SET ANAGRAFICA.TOT_ASS = TOT_ASS+DSum("IMP_ASS","VERS_ASSEGNI","RAPPORTO='" & RAPPORTO & "'")" have error:
    "Dsum not recognized in ... ecc...)
    Why?

    Have a similar solution.
    Tkx.
    Set a variable equal to value of your DSum then use that in your query SQL instead

  3. #3
    sal21 is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    3
    Quote Originally Posted by ridders52 View Post
    Set a variable equal to value of your DSum then use that in your query SQL instead
    tks bro!
    But not completlly understand...
    can you post the complete SQL, please.
    Tks.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,991
    First create a variable & define its type as Double, Long or Integer depending on whether your DSum value will be a whole number etc ...
    So for example:

    Code:
    Dim dblSum As Double
    dblSum = DSum("IMP_ASS","VERS_ASSEGNI","RAPPORTO='" & RAPPORTO & "'")
    
    CurrentDB.Execute "UPDATE ANAGRAFICA SET ANAGRAFICA.TOT_ASS = TOT_ASS + " & dblSum & ";"

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 24
    Last Post: 04-02-2015, 07:34 AM
  2. Replies: 3
    Last Post: 12-23-2014, 01:00 AM
  3. Replies: 4
    Last Post: 12-06-2014, 08:49 PM
  4. Cant get Yes/No to work in Query Access 2010
    By colisemo in forum Queries
    Replies: 1
    Last Post: 09-20-2011, 02:21 PM
  5. Replies: 21
    Last Post: 12-27-2009, 09:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums