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 
Btn to Open New Subform Record
David Buller 
   
4 years ago
Appreciate some advise for a newbie. I have a main form (ClientsFrm) that has a subform (ClientsVisitsQrySubForm). I want to add a command button on the main form that will open up a New (VisitNumber) record in the subform. I have following VBA set to On Click this command button:
  DoCmd.OpenForm "ClientVisitsQrySubform", , , "VisitNumber = " & acNewRec
This button will successfully open a new record in the subform for me to complete but it does not pick up the ClientID field that is associated with the particular main form record that I am viewing at that time. So when I check the actual subform record in the ClientVisitsTbl the ClientID field is blank. Pls can someone advise me on what I need to insert in this VBA so that the new record generated in the subform by this line of VBA also picks up the ClientID that is being viewed in the main form, or do I need to do something completely different. I have tried several additions but none have worked. Many thanks.
Kevin Robertson  @Reply  
          
4 years ago
Check that the Link Master Fields & Link Child Fields as both set to ClientID.
Also, if you are opening the Subform as a single form you may also have to set a Default Value if the form you are opening. See Value From A Form to see how to do this.
David Buller OP  @Reply  
   
4 years ago
Thanks Kevin, I have a working solution now, not as elegant as I'd like but it works! I did indeed have to set a Default Value for the subform form & managed to sort it using the vids you linked me to. My subform is shown in the main form as a table of columns, much like Excel, but my new Add New Client button that I have created opens this subform to add a new record as a stacked form which needed a Default Value. I would prefer for the Add New Visit button to take me directly into the New (blank) Record input part of the Visits Record subform (columns), rather than opening up the stacked New Visit separate form so if you have any suggestions on how I might be able to do this then let me know. Thanks again, I appreciate your help, David

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:23 AM. PLT: 0s