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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Yes/No Check Box 1

Status
Not open for further replies.

ghost807

IS-IT--Management
Joined
Jun 27, 2003
Messages
99
Location
US
I have a Check Box that i need to reset each time a form is loaded. the check box is part of the database.
what i'm trying to do is when the user selects the check box on one form and clicks the ok button it will open another form.
this form will show the selected records in conditional formating. (the form is set up like a map so that the item can be found quickly)
everything works great except the check box stays checked until the user unchecks it.
Is there a way to set all the checkboxes in the table to No when the form opens?
Thanx for any help you can provide me.

 
Yepp.

Add this to the Load() event of your form:

Sub Form_Load()
Me!YourCheckBox=0
End Sub

That's about it! ;-)

MakeItSo



Andreas Galambos
EDP / Technical Support Specialist
Bowne Global Solutions Wuppertal, Germany
(andreas.galambos@bowneglobal.de)
HP:
 
This only seems to work for the current record. not the entire RecordSet.
I think i will try to do a loop but any more suggestions would be really helpfull

 
Try this for the loop:
Dim rs as Recordset

Set rs=Me.RecordsetClone

Do While not rs.EOF
rs!YourCheckBoxField=0
rs.MoveNext
loop

rs.Close

However you could also create a small Update Query:

DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE YourTable SET YourField=0"
DoCmd.SetWarnings True

MakeItSo

Andreas Galambos
EDP / Technical Support Specialist
Bowne Global Solutions Wuppertal, Germany
(andreas.galambos@bowneglobal.de)
HP:
 
This works great. thanx for the help. i ended up using the second method.
just one more quick question.
is there a way to refresh the form after the SQL code has run?
 
BTW i like your web site.
Interresting stuff.
 
Hi ghost807,

It is probably easier just to update the table in a single go before you start, with something like ..

Code:
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE [TableName] SET [CheckBoxName] = No"
DoCmd.SetWarnings True

Enjoy,
Tony
 
[blush] I should have read more carefully. Andreas has already posted the same thing [blush]

Enjoy,
Tony
 
Thanx guys. i had to move where i was doing the SQL code. i ended up placing it in the same event that i use to open the form just running that first.

But once again thank you for the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top