Adding Up Totals from Subforms (1 Viewer)

stu_c

Registered User.
Local time
Today, 01:48
Joined
Sep 20, 2007
Messages
489
Hi all,
Ill do my best to tell you what i am after..

I have a form containing to sets of querys
1: QRY-BikeDetails
2: QRY-DefectsDetails

QRY-DefectsDetails is in a Subform with Bike details, what i want to try and do is to calculate the over figure from QRY-DefectsDetails on the main form i have attached the database & picture to help describe what i need.

I have tried all different coding but still showing Error message :(

also is it possible to have a DELETE Record button as shown that removes the information from both records at the same time?

thanks :)
 

Attachments

  • BIKE DATABASE.zip
    46.7 KB · Views: 85

ansentry

Access amateur
Local time
Today, 10:48
Joined
Jun 1, 2003
Messages
995
Have a look at your db now.
 

Attachments

  • BIKE DATABASE.mdb
    204 KB · Views: 95

stu_c

Registered User.
Local time
Today, 01:48
Joined
Sep 20, 2007
Messages
489
Thank you for doing the database for men
however id like to know how to do this for future, looking at the coding for the lable

=sfrmDefects.Form!TxtTotalEqupment

where is TxtTotalEqupment from for it to make it add this together?
 

ansentry

Access amateur
Local time
Today, 10:48
Joined
Jun 1, 2003
Messages
995
Open the subform (sfrmDefects) in design view and you will see it (TxtTotalEqupment) to the right of "Notes".

Have a look at both of your tables you will see that I have made changes to them, I have used "AutoNumber" instead of text as the primary key. Have a look at the relationships and you will see that I have made changes to the way your tables link. May I suggest that you do not use spaces in your names of fields etc.

I have attached one of my sample db that will show you how to have running totals from subform (if you want it) on a main from.

Good luck with your project
 

Attachments

  • SubForm Running Sum on Main Form.zip
    68.1 KB · Views: 97

JamesMcS

Keyboard-Chair Interface
Local time
Today, 01:48
Joined
Sep 7, 2009
Messages
1,819
Right. What I'd do there is use DSum to calculate the cost of the repairs for the selected bike - have a look at the help file, it's pretty straightforward (you'll want to use the bike fleet number on the main form as your criteria)

To delete subrecords you will want to have a relationship between the two tables with rederential integrity enforced, and the "cascade delete related records" tick box ticked.
 

Users who are viewing this thread

Top Bottom