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 Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Forms Subforms
Catherine Wartgow 
     
6 months ago
Hello I have a Main Form (ExpenseF) and multiple sub forms.
I have a button that changes which subform to open in the main form when I enter in all the information for that (ExpenseID) that I save.
I have the Link Master Fields and the Child Link Fields matching in the (ExpenseID) on all the subforms.
So at a later date, I open the (ExpenseF) and browse through the (ExpenseID) records and see it doesn't save the subform I originally used.
Why does it not bring up the correct subform that was originally linked by the ExpenseID?? Shouldn't it? What am I doing wrong?

Link Master Fields ExpenseID
Link Child Fields ExpenseID

The I have a button to select subform with this code in the event on click to: Example: LAB BUTTON

Private Sub LabBTN_Click()
Me.ExpenseDetailSubF.SourceObject = "Form.ExpenseDetailLabSubF"
End Sub

Please help.
Catherine Wartgow OP  @Reply  
     
6 months ago

Catherine Wartgow OP  @Reply  
     
6 months ago

Catherine Wartgow OP  @Reply  
     
6 months ago
The are my subforms that are selected using the Lab or Vaccination Button. How to make that particular subform stay linked to that particular main form.
Donald Blackwell  @Reply  
       
6 months ago
If you're asking how to ensure the same default subform loads every time you open main form, you may need to add some code or a macro to your main form onopen, onload, or oncurrent event. On open or on load if you just want the form to open with that subform, on current if you want that subform everytime you change records.

Example:

Private Sub Form_OnCurrent()

     SubFormControl.SourceObject = "NAMEOFDEFAULTSUBFORM"

End Sub

The reason it changes is that you probly have it set to save the form when you press your "Close" button so it saves the current active subform in the sourceobject
Catherine Wartgow OP  @Reply  
     
6 months ago
I actually need a particular subform to open with each Expense ID Example: ExpenseID 1 opens the lab subform, but ExpenseID 3 should open with Vaccination. How do you get the subform for that record on the main form to open yhe correct subform.
Donald Blackwell  @Reply  
       
6 months ago
I might add a field to the main expense table to indicate it's preferred subform. Then you could either automatically change the subform in the oncurrent event:

DetailsPrivate Sub Form_Current()

     SubFormControl.SourceObject = VALUEFROMFIELD

End Sub



That would be the easiest method I think if you have navigation buttons that let you move through your records, it would load the default for that expense.

If you wanted to normalize it further, you could use a helper table instead that lists the subform for each expense type and pull the information from there as well.

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

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: 5/2/2026 5:50:30 AM. PLT: 1s