Check and uncheck

G

Guest

I have an optionFrame that contains two check boxes,if i check one of them
and close the form,when i open the form again both of them are unchecked.

I there a way that,whenever i check one of these two check boxes they
remain to be checked even after closing the database ?

Regards
 
R

Rick Brandt

Pietro said:
I have an optionFrame that contains two check boxes,if i check one
of them and close the form,when i open the form again both of them
are unchecked.

I there a way that,whenever i check one of these two check boxes they
remain to be checked even after closing the database ?

Regards

Changes to unbound controls have no place to be saved. If you want data to
persist then you should store it in a table.
 
G

Graham Mandeno

Hi Pietro

If the option group is bound to a field in your form's record source, then
the checkbox corresponding to the stored value will be checked when you
display a given record.

It sounds like your option group is unbound, which means that it will show
the option group's default value when you open the form. If the default
value is null (looks like blank) then the option group will be set to Null
and both checkboxes will be grey and neither of them checked.

If you want the form to "remember" the last setting, then you must store it
somewhere. This could be in a file, or the registry, or a database
property, or most commonly in a table. For example, you could have a table
named "Settings" with a numeric field "SavedOption". The table should have
exactly one record (you can add other fields for other settings).

Then, set the default value of your option group to:
=DLookup("SavedOption", "Settings")

Finally, you need to save the option to the table whenever the user clicks
the other box, so add an AfterUpdate event procedure for your option group:

Private Sub YourOptionGroup_AfterUpdate()
Dim sSQL as string
sSQL = "Update Settings set SavedOption = " & YourOptionGroup
CurrentDb.Execute sSQL
End Sub

I hope this gives you the general idea :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

check box - check all 1
Select Case for "Yes/No" box 2
Clear All Checkboxes 1
Current Record in Visual Basic.... 2
Form with Multiple Check boxes 3
Check box help 3
check box 5
Selecting a record 5

Top