BleepingComputer.com: Calculated fields in Access

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Calculated fields in Access

#1 User is offline   lizi 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 33
  • Joined: 31-March 07

Posted 28 February 2009 - 05:58 PM

Hi,

I am currently building a shop type database...

I have made a 'transaction form' On the form is things such as transaction ID, customer details, staff details etc, then there is a subform, where the products on the transaction get entered into.

On the subform (Transaction/Product link Subform), there are the fields (among others...) 'Product ID', 'Price' and 'Quantity', I have then made an unbound field to calculate the subtotal which has '=[QuantityOrdered]*[p_Price]'

On the main form, I then wanted to have a 'total' field, whereby it adds up all of the subtotals from the subform, the problem is is that through the various methods i have used i keep on getting #Error or it will only show me the subtotal of one record, when I need it to show me the total subtotals from all records.

Any solutions? please :thumbsup:

This post has been edited by lizi: 28 February 2009 - 05:58 PM


#2 User is offline   tos226 

  • BleepIN--BleepOUT
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 1,423
  • Joined: 21-October 04
  • Gender:Female
  • Location:LocalHost

Posted 04 March 2009 - 10:08 PM

View Postlizi, on Feb 28 2009, 05:58 PM, said:

... it will only show me the subtotal of one record, when I need it to show me the total subtotals from all records.


If I understand correctly what you said, I think you need to make a calculated field on the form which will say something like
=Sum(the name of the calculated field on the subform)
and put that total field in the footer of the form. The footer should contain form totals.

#3 User is offline   lizi 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 33
  • Joined: 31-March 07

Posted 05 March 2009 - 04:02 PM

Hey, thanks for the reply. I did do that

I had =sum([Subtotal]) on the subforms footer

Then =[Name of subform].Form![Text16] or whatever the formula is... on the main form

But it just returns #Error or #Name etc :thumbsup:

#4 User is offline   tos226 

  • BleepIN--BleepOUT
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 1,423
  • Joined: 21-October 04
  • Gender:Female
  • Location:LocalHost

Posted 05 March 2009 - 07:29 PM

View Postlizi, on Mar 5 2009, 04:02 PM, said:

I had =sum([Subtotal]) on the subforms footer

I don't have Access in front of me. And don't recall what the subforms footer might be.
I suggested putting it on the form footer, meaning main form. Would that help?

By 'main form' I mean the one that's related to the sub-records forms in a one-to-many relation.

Post your sql query or whatever is behind that expression, perhaps we can see what is going on, though no promises :thumbsup:

This post has been edited by tos226: 05 March 2009 - 07:31 PM


#5 User is offline   lizi 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 33
  • Joined: 31-March 07

Posted 06 March 2009 - 12:05 PM

Hey again,

I figured it out earlier on today :thumbsup: But thank you for your help!

x

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users