Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL function (Access 2000)

    How can i refer to the field size in the following function:
    If size >= 170 Then
    StrSQL = " UPDATE products SET products.grossprice = ([products].[office]+0.5)/0.7"
    End If
    CurrentDb.Execute StrSQL

    The field size is in the table products,the same as grossprice and office.I want to declare it without refering to a form

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: SQL function (Access 2000)

    Do you want to update only those records for which size is at least 170? If so, you should incude the condition in the SQL instead of using If ... End If. Replace

    If size >= 170 Then
    StrSQL = " UPDATE products SET products.grossprice = ([products].[office]+0.5)/0.7"
    End If

    with

    StrSQL = "UPDATE products SET products.grossprice = ([products].[office]+0.5)/0.7 WHERE products.size >= 170"

  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SQL function (Access 2000)

    Super! thats exactly what i was looking for !

Posting Permissions

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