Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 3rd, 2004, 02:40 PM
Jon2112 Jon2112 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 19 Jon2112 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Calculated fields

I have a field called price and one called list price. In a Update Query if possible I would like to do the following

1 Take the PRICE FIELD and get 10% of that field which I understand [Products]![Price] * .1

2 Then I would like to take that result and add it to the Product price field.

3 Last I would like to take that total and update the Corresponding [Products]![listPrice] field with that total.

Should I do this by writing a Function or can I just code it right into the UPDATE FIELD for LIST PRICE. and if so how.

Thanks in advance
Jon

Reply With Quote
  #2  
Old March 3rd, 2004, 06:38 PM
Jon2112 Jon2112 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 19 Jon2112 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Figured it out if anyone is interested

This is the code I used to add 10% to the list price field and update it

Dim PCTVal As Double, Tot As Double
Set rstListPrice = CurrentDb.OpenRecordset("Table Name")
Do Until rstListPrice.EOF
PCTVal = rstListPrice("Price") * 0.1
Tot = rstListPrice("Price") + PCTVal
rstListPrice.Edit
rstListPrice("listPrice") = Round(Tot, 2)
rstListPrice.Update
rstListPrice.MoveNext
Loop

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Calculated fields


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT