Results 1 to 3 of 3
  1. #1
    dickey38 is offline Novice
    Windows 8 Access 2000
    Join Date
    Sep 2014
    Posts
    2

    Update Query Arithmetic

    My experience with database operations is minimal, so this is probably a dumb question, but:

    Is there a way to update a field based on its current value with one query? Like if a table has field "quantity", incrementing that field in a particular record using a single Update Query? Something like:

    Update mytable set quantity=quantity +1 where mykey = ?

    I have done some web searching but found nothing along this line.

    Thanks.

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Yes. Just add your field quantity to your query grid and for your criteria use this.
    Example:

    Refer to the form; [Forms]![YourFormNameHere]![SomeValue]Refer to the Quantity; [SomeQuantity]+1
    HTH

  3. #3
    dickey38 is offline Novice
    Windows 8 Access 2000
    Join Date
    Sep 2014
    Posts
    2
    Burrina,

    Thanks for your suggestion, but I must confess I don't understand it.

    Guess I should have noted that I am working with an Access Database in a website environment, working in ASP.NET. Using server-side scripting, I connect with the database using a connection string, and use methods like ExecuteNonQuery (which takes an SQL query string) to do an update. As far as I know my SQL query can only reference table names and fields in the database. Don't see where a form name comes in to play.

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

Similar Threads

  1. Replies: 8
    Last Post: 08-03-2014, 09:35 PM
  2. Replies: 2
    Last Post: 07-27-2014, 11:39 PM
  3. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  4. Arithmetic with Access
    By Broxi in forum Access
    Replies: 1
    Last Post: 07-28-2013, 07:57 AM
  5. Replies: 2
    Last Post: 08-30-2012, 07:59 AM

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