Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Change CheckBox for all records on FormLoad?

Status
Not open for further replies.

Judalie

Programmer
Mar 25, 2002
40
0
0
US
I have a form that uses a checkbox to populate a field when checked. It makes the field in already opened form match the same field in newly opened form. I am now having a problem in that when the second form opens the next time, the check marks are still there. I have a statment in code that says...

Private Sub Form_Load()
Me!Check28 = False
End Sub

The form lists all records in rows and the statement does clear out the checkmark (if there is one) in the top row but does not clear the remaining checkmarks.. how can I clear checkbox for all records? thanks so much!
j
 
Move your code
Code:
Me!Check28 = False

into the form's OnCurrent event. This will run every time you move to a new record.

HTH
Lightning
 
Hi!

Seems this requires an approach addressing all records in the continuous form. You could run an update query, but I often prefer looping thru the forms recordset, since it's alredy opened.

You could try this in the forms load event:

[tt]dim rs as dao.recordset
set rs=me.recordsetclone
if rs.recordcount>0 then
rs.movefirst
do while not rs.eof
rs.edit
rs!NameOfField = False
rs.update
rs.movenext
loop
end if
set rs=nothing[/tt]

- this will need a reference to the Microsoft DAO 3.# Object Library (in VBE - Tools | References), and remember to use the name of the field holding the True/False value, not the name of the control on the form

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top