Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Expert 7    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
How to Update Cost on Parent Form
Stephen Gledhill 
     
10 months ago
I have built a Parts, supplier and PartXSupplier junction table and associated forms. All works well both ways (Parts Parent Form with Suppliers Subform and vice versa).
There is one issue - I have an Item Cost field in my Parts table which needs to be there, as the Parts are the line items for a Product Bill of Materials.
This item Cost field is the same as the Cost field in the PartXSupplier Junction Table.
When I get updated prices from a supplier, I update the current costs as Richard suggested on the Supplier subform, but because this only updates the field in the junction table, the Item Cost field in the Parts Table isn't updated. I have to do everything twice, which can be very time consumming.
Is there a way to automatically update the Item Cost field in the parent PartF form from the subform Cost field? I will add a screen shot.
Stephen Gledhill OP  @Reply  
     
10 months ago

Sami Shamma  @Reply  
             
10 months ago
Stephen
Yes, you can. You can do that with an update query, or you can do that with a little bit of VBA on the after update event on the change of the cost in the supplier table.

I am curious about your design. What happens when you have multiple suppliers and they have multiple costs? Which one do you take to the header?
Richard Rost  @Reply  
          
10 months ago
So the question is: Which supplier do you want to get the parts cost from? The lowest one? Because if that's the case, then you could have an after update event in your subform that looks at the cost, determines if it is the lowest one, and if so, updates the cost in the parent form. That would all be done with VBA. But it all depends on how you want to figure out which supplier you wanna get the cost from. See what I mean?
Richard Rost  @Reply  
          
10 months ago
That's exactly what Sami is trying to say. For example, I used to do the same thing. Let's say I sold a particular hard drive. Let's call it a Western Digital 2TB hard drive, and I can buy that from three different suppliers: ABC Corp, 123 Corp, and PC Parts R Us Corp.

And so I want to keep track of who has it for each cost. But I don't want to bother updating my costs unless one of the vendors now has a new lower cost. So in that AfterUpdate event, I would look at the other costs from the other suppliers. And if we have a new low, have message box say, "Hey, this supplier now has a new low cost. Do you want to use that?"

The same thing, you might want to change it if the costs have all gone up, right? If the new previous low supplier has gone up, now you gotta increase your cost. So there's a lot of logic behind what you do and when you pick. This would actually make a pretty good video, but it's going to involve some VBA either way.
Richard Rost  @Reply  
          
10 months ago
If you wanted a non-VBA solution, what you could do is use a minimum calculation. Put it in the footer of your subform so you know what the minimum is, and then your parent form could just refer to that minimum value. It'd be a calculated value but wouldn't be stored in the table. =MIN(CostField) in the subform, then =SubFormName.Form!MinField in the parent.

So it's all about if you just want to see it there or not. Then that's what you could do. You can say the minimum cost of this particular hard drive from my 6 vendors is $75 or whatever.
Stephen Gledhill OP  @Reply  
     
10 months ago
Thanks Sami, thanks Richard - you've really given me a lot to think about there!
My database (which I'm re-writing in Access) doesn't have the junction table for the parts / supplier many-to-many relationship. There are two completely separate tables. Suppliers (which doesn't contain any pricing information) and Parts which holds the current price for the Supplier I am currently using for that part. The Parts table des link to the Supplier table, but only to show who the current supplier is.
Lesson 7 showed me the power of the junction table and the extra information it would give me, so I (over) enthusiastically got to work!
Let me think more about what I really want from this and I'll come back as soon as possible.
As you say Richard - it would make a great TechHelp video!

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Expert 7.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/30/2026 2:41:45 PM. PLT: 0s