473,508 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calculated Fields

27 New Member
Hi,
I have the following tables:
tblOrders
tblOrderLine
tblProducts

I have a sub-total field in the table tblOrderLine, in my form the user can select the product using a drop down list which is linked to the ProductID stored in tblOrderLine, they then enter a quantity (also stored in tblOrderLine), on the form i do not have a clue as to how it will calculate a sub-total of that purchase...pleaseeeeeeeee help i would really appreciate it! please please please

Also, even if i do get the sub-totals, how would that be added together for the Total field in tblOrders?! please please help!
Feb 9 '07 #1
6 1743
MMcCarthy
14,534 Recognized Expert Moderator MVP
Hi,
I have the following tables:
tblOrders
tblOrderLine
tblProducts

I have a sub-total field in the table tblOrderLine, in my form the user can select the product using a drop down list which is linked to the ProductID stored in tblOrderLine, they then enter a quantity (also stored in tblOrderLine), on the form i do not have a clue as to how it will calculate a sub-total of that purchase...pleaseeeeeeeee help i would really appreciate it! please please please

Also, even if i do get the sub-totals, how would that be added together for the Total field in tblOrders?! please please help!
The subtotal is a calculated field and as such should not be stored in the table.

In your form footer of the orderline form you can put an unbound textbox and set the control source as follows:

Expand|Select|Wrap|Line Numbers
  1. =Sum([ProductPrice]*[Qty])
Feb 9 '07 #2
Eeek
27 New Member
Oh, Thanks sooo much!, I have heard that calculated fields shouldnt be stored but i just didnt know what else to do, thanks a lot for your help!
Feb 9 '07 #3
Eeek
27 New Member
I tried doing that, however, it just displays "#error'
I don't know why it doesn't work; perhaps because it cannot look up the Price of the products from the tblOrderLine form?!
Could you let me know as to how i could get it to look up that value?! please please help
Feb 10 '07 #4
nico5038
3,080 Recognized Expert Specialist
Guess you can have multiple combinations of [ProductPrice] and [Qty] in your detail rows.
Best to first create a query to extract all rows from your table and add a field:
select [ProductPrice]*[Qty] as Amount, ...

Just "forget" to place that in the details section and use in the footer:
=Sum([Amount])
Also make sure the fieldname (see properties) is NOT [Amount] as Access will see that as a circular reference...

Nic;o)
Feb 10 '07 #5
Eeek
27 New Member
Sorry, I'm very very new to Queries, could you give me some more info please, i need to save all of these sub totals to give me a Total for the tblOrders, how would i do this, or would i need to store this field?
Feb 11 '07 #6
NeoPa
32,557 Recognized Expert Moderator MVP
As per your other question (Querying database by date), you need to post the table MetaData.
Without this we can only guess at your fieldnames and as you don't seem experienced enough to translate this into workable SQL that isn't working for you.
Feb 11 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3684
by: Anonymous | last post by:
Hi all, I have a form people use to enter checking data. One of the fields is calculated based on finding the difference of two input fields on the form. Here are the fields: CheckAmount...
1
5375
by: Miguelito Bain | last post by:
hi everybody. i'm trying to find out what you can and can't do with/in calculated fields. any help, pointers, and/or advice would be greatly appreciated. i'm a newbie, but i want to learn, and...
5
4034
by: John Bahran | last post by:
I am trying to use calculated fields in my query but all the results are zero ven when they're not. Please help. Thanks.
2
2011
by: david | last post by:
Hi, I have a form with a couple of calculated fields. I want to put some code into the 'Form-Load' event to set various object states on the form, depending on the value of these fields. The...
2
4970
by: Ryker | last post by:
I have a Purchase Order where I have a calculated field called Price that is calculated by multiplying Qty * Sales Price. I have 10 of these fields...Price 1 - Price 10 (for each line of the PO). ...
2
3967
by: Olveres | last post by:
Hi, I have managed to work out how to add new lines into a calculated text box. However in this text box some of the outcome fields are empty however when previewing the report it includes the...
5
5873
by: Henrik | last post by:
The problem is (using MS Access 2003) I am unable to retrieve long strings (255 chars) from calculated fields through a recordset. The data takes the trip in three phases: 1. A custom public...
2
5506
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by...
3
4267
by: Matthew Wells | last post by:
If I have a calculated field that returns a value from a udf, does that field get calculated even when it's not being used in a Select statement? I knw that if a calculated field's formula is...
2
4272
by: mkbrady | last post by:
I have a query that includes calculated fields that generate numeric results. I have wrapped conversion functions CLng() and CDdl() around the calculated fields to ensure the data types are...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1553
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.