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. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #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"

  4. #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
  •