Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table/Form Default Value

Status
Not open for further replies.

toqilula

Programmer
Dec 22, 2009
3
RS
Hi,
I have a subform (continues form) that display records from a table. i have 4 fields
[item]
[qty]
[price]
[total]
how should i set the default values and where, wether in table or in subform, so i can see the sum of two fields multiplyed.
I have tried
=Nz([Qty])*Nz([Price]) it workes but only for the first row.
and in continues form where i have the unbound textbox it displays the same value for all other records/rows.
I have tried to put it as default value in field in the table, but I get an error.
I would very much appreciate if anyone can help me.
thank you in advance
 
Your calculation should be done at the form/report level. The calculation should not be stored. That means you would NOT have a [total] field.


If you want the sum for all the lines in the continuous form then place a text box in the form's footer and set the control source to be:

=SUM(Nz([Qty],0)*Nz([Price],0))








Boyd Trimmell aka HiTechCoach
Microsoft Access MVP
 
Hello HiTechCoach,
thank you very much for your quick reply,
I have put what you told me and i still have the same problm. i have only the sum from first record to all others in my Continuous Form.
please see the attached printscreen of my Continuous Form.
i hope it explains what im trying to acomplishe in here.
thanx again
 
 http://www.mediafire.com/?4t50650z76pms1a
Hi Dhookom,

thank you for your worm welcome, I am still desperet in finding solution, i'm pretty sure there is a solution to this. im searching on the web since 48 houres now, I almos fot to the web page "The End", they say its the end of internet, I feel im close ot it.
HiTechCoach please if you have time respond to my thread, thank you.

my dba:

Table: itemtbl
ID - AutoNumber/Long Integer/Increment (default created by access 2007)
Item - Text/255
Price - Currency/Euro/Auto
Qty - Number/Single
Total - Currency/Euro/Auto

Continuous Form: fields,
name: Itemtxt
selection type: Text Box
Control Source: Item
---
name: Qtytxt
selection type: Text Box
Control Source: Qty
---
name: Pricetxt
selection type: Text Box
Control Source: Price
---
name: totaltxt
selection type: Text Box
Control Source: Unbound
--------
I have 3 records on table called itemtbl
(this is how its diplayed on my continuous form)
ID Item Qty Price Total
1 Book 1 2.50
2 Pencil 3 1.40
3 TV 2 99.90
------
Agan how to multiply qty with Price and get a sepret value on my total filed

Kind Regards
 
 http://www.mediafire.com/imgbnc.php/b89fd6704f8fb5a5fc53e8c4bdb3a2466g.jpg
Actually my "Welcome aboard" was to fellow Microsoft MVP, Boyd Trimmell (HiTechCoach) but I am happy to extend the welcome to you also ;-)

Boyd was suggesting that you do not need a Total field in your table since you can use a text box in the detail section of your form/report with a control source of:
Code:
  =Nz([Qty],0)*Nz([Price],0)
In the header or footer section of the same form/report, you can use a text box with a control source of:
Code:
  =Sum(Nz([Qty],0)*Nz([Price],0))


Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top