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 25 January 2004, 11:42 PM
  #1  
awd2000
Scooby Newbie
Thread Starter
 
awd2000's Avatar
 
Join Date: Aug 2001
Location: Beds
Posts: 19
Likes: 0
Received 0 Likes on 0 Posts
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.
Old 26 January 2004, 08:04 AM
  #2  
GaryK
Scooby Regular
 
GaryK's Avatar
 
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes on 0 Posts
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
Old 26 January 2004, 08:32 PM
  #3  
awd2000
Scooby Newbie
Thread Starter
 
awd2000's Avatar
 
Join Date: Aug 2001
Location: Beds
Posts: 19
Likes: 0
Received 0 Likes on 0 Posts
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!
Old 27 January 2004, 08:29 AM
  #4  
GaryK
Scooby Regular
 
GaryK's Avatar
 
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes on 0 Posts
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
Old 27 January 2004, 08:26 PM
  #5  
awd2000
Scooby Newbie
Thread Starter
 
awd2000's Avatar
 
Join Date: Aug 2001
Location: Beds
Posts: 19
Likes: 0
Received 0 Likes on 0 Posts
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
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
02 July 2023 01:54 PM
TylerD529
General Technical
2
09 October 2015 01:53 AM
Littleted
Computer & Technology Related
4
25 September 2015 09:55 PM
ben6090
General Technical
17
13 September 2015 08:05 PM
farmerwrx
Computer & Technology Related
14
10 September 2015 11:59 AM



Quick Reply: Any Access 2002 gurus out there?



All times are GMT +1. The time now is 08:45 AM.