Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Apr 2010
    Location
    Sofia
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have the following working updating function which is ok:

    CurrentDb.Execute "UPDATE Products SET office = products.grossprice*0.72"

    I want to add on a condition depending on the field “code” in the same table products. But I do no know how to do it.I do not want to use a form but otherwise is it possible to do it ?
    What I want to achieve is the following:

    If Products.code = 10153 or Products.code = 10567 or Products.code = 324555 Then
    CurrentDb.Execute "UPDATE Products SET office = products.grossprice*0.72"
    Else
    CurrentDb.Execute "UPDATE Products SET office = products.grossprice*0.9"

    How can I do it with Currentdb.execute command?

  2. #2
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,179
    Thanks
    47
    Thanked 983 Times in 913 Posts
    I would use a WHERE Products.code = 10153 qualifier. Not sure of the syntax though. Something like:
    CurrentDb.Execute "UPDATE Products SET office = products.grossprice*0.72" WHERE Products.code = 10153

    cheers, Paul

  3. #3
    Lounger
    Join Date
    Apr 2010
    Location
    Sofia
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much inded for the excelent solution

Posting Permissions

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