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 
Trouble selecting ID in SubFor
Jerry Fowler 
       
2 years ago
I have a database that opens with the form MainF as seen in the following jpg. That form has a SubFormCtl that loads other forms depending on which button is pushed. Dashboard opens DashboardF, Owners opens OwnerF, and so on. When I have owners clicked it looks like the 2nd jpg. This is where I have an issue, I would like to search for an Owner, so I click on Search and that OwnerListF opens up, I can Dbl click on any ID and I would like it to the re-open MainF, act as if the Owners button was clicked and load the OwnerF into the SubFormCtl ahnd then goto the OwnersID that I clicked on the OwnerListF. I have tried several things with no luck here is my latest VBA on the Double Click Event on the OwnerListF;

Private Sub OwnerID_DblClick(Cancel As Integer)

    ' Load the MainF form
    DoCmd.OpenForm "MainF"
    
    ' Load the SubFormCtl Source Object with the form OwnerF
    SubFormCtl.SourceObject = "OwnerF"
    
    ' Goto the OwnerF Subform
    DoCmd.GoToControl "OwnerF"
    
    ' Goto the OwnerID field
    DoCmd.GoToControl "OwnerID"
    
    ' Find the OwnerID
    DoCmd.FindRecord OwnerId ' I'm sure I also tried Me.OwnerF.OwnerID as well
    
    ' Close the OwnerListF
    DoCmd.Close acForm, "OwnerListF", acSaveYes
    
End Sub
Jerry Fowler OP  @Reply  
       
2 years ago

Jerry Fowler OP  @Reply  
       
2 years ago

Jerry Fowler OP  @Reply  
       
2 years ago
When I run this the very first SubFormCtl.SourceObject = "OwnerF" receives an error Variable not defined.
Sami Shamma  @Reply  
             
2 years ago
First of all, are these on top buttons or tab controls?
Sami Shamma  @Reply  
             
2 years ago
Second, why go through all that when you can simply have a combo box bound to your customer table, sitting adjacent to the name label? Am I missing something?
Jerry Fowler OP  @Reply  
       
2 years ago
No Sami you're not missing anything, I had thought of that, but of course, if there is a hard way to do something that's the way I always go. :) I have a version of the form that does exactly that but I'm still trying to figure this one out.  Thanks for your time on this.
Sami Shamma  @Reply  
             
2 years ago
Excellent!
Jerry Fowler OP  @Reply  
       
2 years ago
Sami also those are buttons that use this VBA code:

Private Sub DashboardBtn_Click()
    
    SubFormCtl.SourceObject = "DashboardF"

End Sub
Jerry Fowler OP  @Reply  
       
2 years ago
Sami, I went to my form that has the combo box and it does work perfectly, I'm not going to pursue the other method. But as soon as I did switch to the combobox when I clicked on the Owners button to load the OwnerF it did not align top left, but rather it moved down on the form just a tad as seen in the jpg. Thanks
Jerry Fowler OP  @Reply  
       
2 years ago

Sami Shamma  @Reply  
             
2 years ago
It's just a matter of alignment. Off the/pet label field.

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/7/2026 2:21:40 AM. PLT: 1s