Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Help   Contact   Merch   Join   Order   Logon   Forums   
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
RecordSet on SubForms
Gary Orros 
     
3 years ago
Hi Everyone,

Not sure if you need some pictures, I can attach them if needed.
I have a main customer form which has the customer's locks they own displayed on a subform. The record selector on this Subform then sets the related Key History records and then displays that on another Subform. This is a continuous list form.

It all works fine together except the issue I have is whenever I update a record or delete something as my forms Requery, The record selector goes to the top of the list. This could be an issue going forward as when adding a couple of entries I would need to remember to select the right record again or end up adding the wrong History to the wrong Cylinder.

I have watched the RecordSet video but can't make it work on a Subform. I have tried a few things in my head but I couldn't fix it.

A nudge in the right direction would be very helpful.

Thanks
Kevin Robertson  @Reply  
          
3 years ago
Gary Orros OP  @Reply  
     
3 years ago
Thanks Kevin, will check that one out
Gary Orros OP  @Reply  
     
3 years ago

The trouble I think I have is that the only way I could make my Subforms ReQuery was to Requery the parent Form and not the Subform. So on close event the ReQuerys runs on  parent form and the focus changes on the Subform.
Kevin Yip  @Reply  
     
3 years ago
To requery the subform from the main form, use below, which will not move the subform's record selector (i.e. requery in place):

     Me![MySubformNameHere].Form.Recordset.Requery

To requery the subform from the subform:

    Me.Recordset.Requery
Gary Orros OP  @Reply  
     
3 years ago
Sorry guys I don't think I've explained that very well, my subforms are set up to display the data only. I plan to edit the data with helper forms and I guess that is why I can't requery like that.
Gary Orros OP  @Reply  
     
3 years ago

Gary Orros OP  @Reply  
     
3 years ago

Gary Orros OP  @Reply  
     
3 years ago

Gary Orros OP  @Reply  
     
3 years ago

Gary Orros OP  @Reply  
     
3 years ago

Gary Orros OP  @Reply  
     
3 years ago

Gary Orros OP  @Reply  
     
3 years ago

Kevin Yip  @Reply  
     
3 years ago
When you close your helper form (in the Close event), run this to requery-in-place the main form's subform:

    Forms![MainFormNameHere]![MySubformNameHere].Form.Recordset.Requery

This is a fully-qualified reference to the main form that can be used anywhere, as long as the main form is opened.
Gary Orros OP  @Reply  
     
3 years ago
Hi Kevin

Unfortunately, it didn't work, I had tried this way before. It seems the only way I can make either SubForm Update is to just update the Main Form. The trouble is that when I update the Main Form the record selectors reset.

My on close event is

Forms!AdminCustomerComF.Form.Recordset.Requery

Gary Orros OP  @Reply  
     
3 years ago

Gary Orros OP  @Reply  
     
3 years ago
I get this error if I try to use the Subform
Kevin Robertson  @Reply  
          
3 years ago
What was the error message?
Gary Orros OP  @Reply  
     
3 years ago
Run-time error '2465'

Access can't find the field @AdminKeyHistoryEditComF' referred to in your expression
Gary Orros OP  @Reply  
     
3 years ago
Think the penny just dropped, its looking for the form to requery but the form is already closed.
Kevin Yip  @Reply  
     
3 years ago
HI Gary, you didn't use the code and the form names in the right places.  See the picture below on where to put the code, unless I misunderstand what you try to do.  You should put the code in the helper form's Close event, and reference the main form and subform in the manner as shown.
Kevin Yip  @Reply  
     
3 years ago

Gary Orros OP  @Reply  
     
3 years ago
I started again with the VBA in all the On Close events as you've said and it now works.
I think I must have had a mix of some correct and then some that I got mixed up on because they weren't all wrong when I went through them. But doesn't matter all that counts is it now works, just to repeat for the different customer types now one set works.

Thanks so much for your import, I appreciate your help and tolerance with me.

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: 8/7/2026 5:15:29 PM. PLT: 1s