Solved

How update all records in a subform

Posted on 2014-03-12
2
453 Views
Last Modified: 2014-03-12
I have a main form that has a checkbox and the onclick event of the checkbox is:

    If Me.chkbxGrowDay1Selected = True Then
       Forms!frmPlanted!subfrmReady.Form!txtReadyDate = Me.txtplantdate + Me.txtGrowDaysCalc
    End If

But when the checkbox is clicked only the first record in the subform on the main form is updated.  I need all records in the subform to update.

How do I get that to happen?  It's almost like it has to loop through the records in the subform but I don't know how to make that happen.
0
Comment
Question by:SteveL13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 39923413
Either:

1. Execute an update query and then requery the form

or

2. Loop through the forms records:

 Dim rst as DAO.Recordset

Set rst = Me.RecordsetClone

If rst.Recordcount > 0 then
   rst.MoveFirst
   
   Do until rst.Eof
        ' do something
   Loop
End if

Set rst = nothing

Jim.
0
 

Author Comment

by:SteveL13
ID: 39923509
This worked:

 Execute an update query and then requery the form
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question