Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Any Access 2002 gurus out there?

Thread Tools
 
Search this Thread
 
Old Jan 25, 2004 | 11:42 PM
  #1  
awd2000's Avatar
awd2000
Thread Starter
Scooby Newbie
 
Joined: Aug 2001
Posts: 19
Likes: 0
From: Beds
Question

Probably being very dense but...

If I update a database table field in an "update" action
query, how do I get it to use the updated value of this field
in another "update to" expression in the same query?

At the moment I'm only getting the "before update" value
of the first field being used in the update expression of
the second one.
Reply
Old Jan 26, 2004 | 08:04 AM
  #2  
GaryK's Avatar
GaryK
Scooby Regular
 
Joined: Sep 1999
Posts: 4,037
Likes: 0
From: Bedfordshire
Post

Its not possible, each SQL command is a unit of work or a transaction, the new values will not get applied to the columns until the whole statement has executed this isnt an access 2002 issue its standard SQL. Can you post what it is you are trying acheive maybe another way.

cheers

Gary
Reply
Old Jan 26, 2004 | 08:32 PM
  #3  
awd2000's Avatar
awd2000
Thread Starter
Scooby Newbie
 
Joined: Aug 2001
Posts: 19
Likes: 0
From: Beds
Thumbs up

Thanks Gary

In a single-pass update query I am trying to..
1. Set 'Price' to a new value from a fairly complex calc
2. Set 'VAT' to 17.5% of this new value
3. Set 'Total' to the new value of 'Price' plus the calc value of 'VAT'

For a number of arcane reasons, the underlying table fields can't have expressions associated with them, hence using a query.

I've worked around the problem by...
1. Setting 'Price' =(complex calc expression)
2. Setting 'VAT' = (complex calc expression)*0.175
3. Setting 'Total' =((complex calc expression)+((complex calc expression)*0.175)

Not very elegant and a pain to maintain!
Reply
Old Jan 27, 2004 | 08:29 AM
  #4  
GaryK's Avatar
GaryK
Scooby Regular
 
Joined: Sep 1999
Posts: 4,037
Likes: 0
From: Bedfordshire
Thumbs up

No problem, one of the industry strength DBMS such as SQL server would let you get around this by using stored procedures which would let you store these calcuations in variables before running the update statement. Dont know if you know but you can get a cut-down version of SQL Server called MSDE which is a free download. It makes deployment a little trickier but is way more robust and scalable than an access solution.

cheers

Gary
Reply
Old Jan 27, 2004 | 08:26 PM
  #5  
awd2000's Avatar
awd2000
Thread Starter
Scooby Newbie
 
Joined: Aug 2001
Posts: 19
Likes: 0
From: Beds
Talking

Thanks - I'll get this round of changes done and dusted and then I guess it's time to play with a real RDBMS!

Cheers
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
Jul 2, 2023 01:54 PM
TylerD529
General Technical
2
Oct 9, 2015 01:53 AM
Littleted
Computer & Technology Related
4
Sep 25, 2015 09:55 PM
ben6090
General Technical
17
Sep 13, 2015 08:05 PM
farmerwrx
Computer & Technology Related
14
Sep 10, 2015 11:59 AM




All times are GMT +1. The time now is 05:40 PM.