Solved

How update all records in a subform

Posted on 2014-03-12
2
424 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
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Run Time Error 3071 26 41
Cross Tab with two column values 7 38
Set focus on next field when character count = 5 9 12
Access Query based on a Form Field 2 21
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now