|
-
Jul 10th, 2000, 04:44 PM
#1
Thread Starter
Addicted Member
Given a simple Access DB Table with the following:
Item UnitPrice Qty
Muffler $28.00 3
Horn $10.00 2
Is it possible for or in VB to create a fourth field "Totals" that multiplys the values of UnitPrice times Qty and places the results there, i.e.,
Item UnitPrice Qty Totals
Muffler $28.00 3 $84.00
Horn $10.00 2 $20.00
-
Jul 10th, 2000, 05:40 PM
#2
Hyperactive Member
I can't figure out exactly what you want. Could you be more explicit? do you have any code segment that want to be better?
Ulises Vázquez
[size=1.7]Oracle DBA Certified Professioanl
Visual Basic 6 Developer
Crystal Reports Designer
[/size]
-
Jul 10th, 2000, 09:14 PM
#3
Member
You can do this in one of two ways. Firstly you could create a query at the database level that created the new field based on the calculation, or alternatively through VB you could open a recordset with the same SQL and as with the previous way it creates a dynamic field for your use.
The SQL for the query would be
SELECT tblParts.Item, tblParts.Quantity, tblParts.Cost, [quantity]*[cost] AS Total
FROM tblParts
You can see here that we create a field by the code[quantity]*[cost] AS Total
So when you open the recordset you will have access to all four fields (Item,Quantity,Cost,Total) just like a table.
-
Jul 11th, 2000, 05:48 AM
#4
Thread Starter
Addicted Member
Thanks CGTS, this is what I was looking for
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|