473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How do i get a total from subform on purchase order?

I have created a database to create and store purchase orders. My tables are as follows -
Tbl Order details (Qty, desc,price,total),
Tbl Order no (ON, date, date required, supplier)
Tbl Supplier (Supplier name, address)

I have created the Purchase order in form with subform. I am having difficulty getting the form to create a final total. I have tried '=sum([total]).
Apr 19 '11 #1
7 2544
mshmyob
904 Expert 512MB
You are going to have a lot more trouble than trying to do a simple addition.

1. You need first to not use reserevd words such as ON and Date.

2. You need primary keys and foreign keys (you have no relations between your tables.

3. You need to normalize your database.

I would suggest reading up on normalization.

cheers,
Apr 19 '11 #2
Thanks for your help I'll have a read..I do have relationships attached screen dump, showing tables/relationships.

Attached Images
File Type: jpg Relatonships.jpg (21.0 KB, 458 views)
Apr 19 '11 #3
NeoPa
32,556 Expert Mod 16PB
Sandretto, Part of your task when posting your question is to consider what information is required to enable someone to understand it well enough to give an answer.

In this case (all) the details of the table structure are required, as well as enough information about your form to indicate what might be going wrong. It's hard to answer a question when there is no real question there.
Apr 19 '11 #4
Apologies for the lack of information. I have attached a screen print from design view of form.
I need to add up a grand total from the 'Total' column of the subform. On the screen print you can see the attempt I made at the sum, but this doesn't work.

SQL for Main form -
Expand|Select|Wrap|Line Numbers
  1. SELECT [ORDER NO].[TO:], [ORDER NO].[ORDER NO], [ORDER NO].[ORDER DATE], [ORDER NO].[DELIVERY ADDRESS], [ORDER NO].[REQUIRED DATE], [DELIVERY ADDRESS].NAME, [DELIVERY ADDRESS].[ADDRESS 1], [DELIVERY ADDRESS].[ADDRESS 2] AS [DELIVERY ADDRESS_ADDRESS 2], [DELIVERY ADDRESS].[ADDRESS 3] AS [DELIVERY ADDRESS_ADDRESS 3], [DELIVERY ADDRESS].POSTCODE, SUPPLIER.[SUPPLIER NAME], SUPPLIER.ADDRESS1, SUPPLIER.[ADDRESS 2] AS [SUPPLIER_ADDRESS 2], SUPPLIER.[ADDRESS 3] AS [SUPPLIER_ADDRESS 3], SUPPLIER.[POST CODE]
  2. FROM SUPPLIER INNER JOIN ([DELIVERY ADDRESS] INNER JOIN [ORDER NO] ON [DELIVERY ADDRESS].[DEL ADD CODE] = [ORDER NO].[DELIVERY ADDRESS]) ON SUPPLIER.[SUPPLIER CODE] = [ORDER NO].[TO:];
SQL from subform -
Expand|Select|Wrap|Line Numbers
  1. SELECT [ORDER DETAILS].QUANTITY, [ORDER DETAILS].DESCRIPTION, [ORDER DETAILS].PRICE, [QUANTITY]*[PRICE] AS TOTAL
  2. FROM [ORDER DETAILS];
Sorry again for my mistake. I hope I have given the full question and information required

Attached Images
File Type: jpg screen view form.jpg (49.3 KB, 509 views)
Apr 19 '11 #5
NeoPa
32,556 Expert Mod 16PB
Sandretto:
On the screen print you can see the attempt I made at the sum, but this doesn't work.
I'm afraid we cannot see it. It seems you've done a much better job now certainly. All text should be posted as text though. Pictures are not of good enough quality generally for passing textual information. We would also need an explanation of what does happen if, as you say, it doesn't work. Not working can mean so many things.

I suggest you also respond to Mshmyob's post directly. He has offered some important advice.
Apr 20 '11 #6
Morning
I'm not very good at this forum thing! I am still learning tho. I have good news I have worked out how to do what I requested. I 'normalised' my database from the advice give by mshmyob. I then thought about what I wanted. I entered "=sum([Quantity])*([Price]") into the form footer on the subform, this calculated the total and then on the main form entered "=(order details subform)!Grand Total" All is working order thanks for everyones help and sorry for the confusion on my part.
Apr 20 '11 #7
NeoPa
32,556 Expert Mod 16PB
Sandretto:
I'm not very good at this forum thing! I am still learning tho.
That's the important thing :-) No apologies necessary. You did a fine job considering it's all very new for you.

Good job on working out the solution as well ;-)
Apr 20 '11 #8

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

Similar topics

5
by: Lapchien | last post by:
I have a purchase order database, i use 1 particular supplier very often - i'd like to put a button on my form which, when pressed, 'auto-filled' several fields (like supplier name, address,...
0
by: John Hunter | last post by:
I've recently had a nasty problem with the "Invalid reference to the property Form" error in subforms - nasty because it doesn't seem to consistently happen to all forms which contain the same...
1
by: sasan3 | last post by:
I have a main form "topform" contaning "subform1" and "subform2" The goal is: I need to requery subform2 on CURRENT event of subform1, and I need to load subform2 contents based on settings on...
0
by: Rajani | last post by:
Hello, I have two tables. pomain and posub pomain: ponumber,podate,issuedby posub: posubid,ponumber,itemcode,qty,price I am new to dotnet. How can i add data to these two tables. 1 record...
1
by: Diggar | last post by:
I have a data base with about 4 different tables. 1. Cust info 2. Supplier info 3. Order History 4. Order details. Order history and details are on one form with details being the subform....
4
by: John Torres | last post by:
I have added a "Preview Report" button on my main Form Page to mainly "print preview" current page including the 1st subform and I already designed the Report Page for it. But for some reason it...
1
by: yltang | last post by:
In an order system, there are tables of customers, products, orders, and order details, with the main fields listed as follows: tblCostomer: CustomerID, CustomerName, ... tblProduct: ProductID,...
6
by: GLEberts | last post by:
Novice looking for some direction!! I am trying to have a text box autopopulate with a number added to it at the end and I am having a difficult time doing this. Example: (1) I have a combo...
3
by: EINSTEIN1221 | last post by:
I have created a program for our company in Access 2003 that allows users to track inventory, pricing and create purchase orders. I have also created a similar table for tickets. My purchase order...
3
by: 125a29 | last post by:
hi i'm trying to update total order cost in order table , basically what i want when i edit order item table such as changing quantity then it automatically update the total cost in order table i...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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...

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.