Access 2007-2016
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  


Microsoft Access Forum
By Richard Rost   Richard Rost on Facebook Richard Rost on Twitter Richard Rost on Google Plus Richard Rost on LinkedIn Email Richard Rost

This forum is for the discussion of Microsoft Access.

Access is my personal specialty. Have questions? Comments? Want to discuss how to do something? Post it here. Also, I get a LOT of questions sent to me in Email from people around the world. I'll post the interesting ones in here. Feel free to comment on them.

Click Here To Subscribe to this forum and receive an email update whenever new posts are added, just scroll down to the bottom of this page and enter your email address in the comment form.

Permanent Link
Keywords: microsoft access forum
Post New Topic

Read Recordsetclone Subform by steve m @ 3/5/2013

Thank you for the reply. I am trying to update my main form and subform based on a check box. When clicked I want my main form's text box [Process Date] to update with today's date. I then want to update the associated records in my subforms combo box [Combo268]. If my subform has 4 records, I want all four records to be updated instead of just the first record. I wanted to display an msgbox at the end with the record count.

I was using the following for that:
MsgBox "If needed, update property information for " & rst.RecordCount & " property bags below.", vbOKOnly, "Update when applicable"

In return, if the main form combo box is unclicked, I want the date removed and the subforms combo box back to another value.

Reply from Richard Rost:

Well, you could use a simple SQL command to perform the change:

Docmd.RunSQL "UPDATE WhateverT SET Field=NewValue WHERE ID=RelatedID"

Of course, you'll need to adjust the names accordingly. I cover this in my SQL Seminar, Part 2. Then if you really want a count of the items changed, you could just use DCOUNT to look it up. Two lines of code.

But you could also do all of this with just a simple recordset loop too. No need for a clone.
Show Just This Thread        Post Reply
Read Recordsetclone Subform by steve m @ 3/4/2013

I searched previous post but didn't see additional information about a recordsetclone.

My main form is a continuous form. In my form footer I have a subform, also a continuous form.

I am attempting an after update of my main form on a check mark field that will update the form footers subform.

Right now, my code updates only the first record of the subform, not all the records. It also produces an error if no record exist for the subform. Can you point me in the right direction? I want to stay with VBA to use the similar code on anothe form rather than doing an update query.

Private Sub Process_AfterUpdate()
If Me![Process] = -1 Then
   Me![Process Date] = date

Dim rst As DAO.Recordset
Set rst = Me.SubfrmDetaineeReviewGroupOut.Form.RecordsetClone

        With rst
        Do Until rst.EOF

            'check to see if bagnum has value first
            If IsNull(Forms![Detention Group Edit1]!SubfrmDetaineeReviewGroupOut.Form!BagNum) Then Exit Do
            Forms![Detention Group Edit1]!SubfrmDetaineeReviewGroupOut.Form!Combo268 = 2
            End With
           Set rst = Nothing

MsgBox "My Message.", vbOKOnly, "Update when applicable"
    Me![Reason for Detention].SetFocus
    Me![Reason for Detention].Dropdown
Else: Me![Process Date] = ""
'check to see if bagnum has value first
If Not IsNull(Forms![Detention Group Edit1]!SubfrmDetaineeReviewGroupOut.Form.BagNum) Then
    Forms![Detention Group Edit1]!SubfrmDetaineeReviewGroupOut.Form.Combo268 = 1

End If
End If
End Sub

Reply from Richard Rost:

I don't like recordsetclones. Never have. Tell me what you're trying to DO (instead of showing me what you've got that's not working) and I'll try to suggest the best solution.

Show Just This Thread        Post Reply

Collapse All Topics


Post Your Comments or Subscribe
    If you would like to be notified of new posts on this forum,
    just enter your email address below. It will be kept private.
If you just want to subscribe to get email updates when this forum is updated, then enter your name and email address and check the Notify Me box below. If you would optionally like to add your comments below to be posted, they are welcome.
  Your Name:  Required
  Your Email:  NOT Public


Sorry about this step. It's just to keep the spam bots away:
  Verify: What is 6+6:
  Notify me when the this forum is updated
  Remember Me for my next comments
Please do not use this form for Customer Service inquiries! If you have questions about your account, shipping info, courses you've ordered, need passwords, etc. please use the Customer Service Center instead.

I value your comments. They will be displayed on this page (above). Your name will be displayed, but your email address will not be.
As always, I promise to never give away your personal information to anyone else, ever.

NOTE: If you don't leave your name and email address, DON'T expect a reply. I can't promise a personal reply to everyone who posts here. I TRY my best, but I cannot guarantee it. If you don't leave your real name and email address, I won't even bother. I usually just hit DELETE. -Richard



You may want to read these articles from the 599CD News:

7/19/2017Access Developer 2 and 3 Released
7/19/2017Microsoft Access Developer 3
7/19/2017Microsoft Access Developer 2
6/30/2017Access Developer 2 is Finished
6/7/2017Microsoft Access Developer 1
6/6/2017Access Developer 1 is Finished
5/18/2017Microsoft Access Advanced 6
5/17/2017Access Advanced 6 is Online
4/9/2017Microsoft Access Advanced 5
4/9/2017Microsoft Access Advanced 4

Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP