Results 1 to 2 of 2
  1. #1
    ..Areith.. is offline Novice
    Windows XP Access 2003
    Join Date
    Apr 2011
    Posts
    1

    Update Error

    Hello to everyone.


    I was programming on an Access's database.

    Biggest issue is that i have to round off some values in a very nasty way.
    Now, the rounding off subroutine is ok and works. I have called it Allineamento.

    Datas are got from a table and pulled in Elenco which is a summary box.
    lisagros is the field that i want to change using my sub-routine.

    What doesn't work is the Update sql.
    Here is the code:
    Private Sub Comando0_Click()

    For i = 0 To Elenco.ListCount - 1
    Test = Allineamento(Elenco.Column(5, i) * 30 / 100 + Elenco.Column(5, i))
    lisagros.Value = Test
    SQL = "UPDATE Arrotondamenti SET lisaros=" & lisagros.Value & "WHERE Price=" & Elenco.Column(5, i)
    DoCmd.RunSQL SQL
    Next
    End Sub

    Any clue of why it doesn't work?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Do you get a syntax error on the SQL or what error are you getting?

    You should put a debug.print SQL (before the Docmd.runsql) so you will see in the immediate window how the
    SQL has been been transformed with the values for
    lisagros.Value and Elenco.Column(5, i)

    I think you are missing spaces after lisaros= " and another before " Where ...


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

Similar Threads

  1. Replies: 9
    Last Post: 11-09-2011, 11:34 AM
  2. Error: Can not update record; currently locked
    By waldzinator in forum Programming
    Replies: 4
    Last Post: 03-29-2011, 08:40 AM
  3. VBA to update field contents...Error 91
    By jpkeller55 in forum Access
    Replies: 9
    Last Post: 10-11-2010, 07:52 PM
  4. Replies: 3
    Last Post: 07-21-2010, 02:41 AM
  5. Replies: 1
    Last Post: 12-09-2005, 09:16 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