You'll have to save the values somewhere, and in a database app the simplest
place to save values is in a table. But you certainly can save them
elsewhere if you wish, for example you could save them in an INI file or in
the registry, or in custom properties. Here's an example that uses the
AccessObjectProperties collection. Because this is quick-and-dirty example
code, I've used On Error Resume Next to handle the situation where you open
the form for the first time, and the properties do not yet exist. In a
finished app you might want to consider more robust error handling. That
said, here's the example ...
Private Sub Form_Load()
Dim ao As AccessObject
Dim ctl As Control
Set ao = CurrentProject.AllForms(Me.Name)
On Error Resume Next
For Each ctl In Me.Controls
If ctl.ControlType = acCheckBox Then
ctl.Value = ao.Properties(ctl.Name).Value
End If
Next ctl
On Error GoTo 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim ao As AccessObject
Dim ctl As Control
Set ao = CurrentProject.AllForms(Me.Name)
For Each ctl In Me.Controls
If ctl.ControlType = acCheckBox Then
ao.Properties.Add ctl.Name, NZ(ctl.Value, False)
End If
Next ctl
End Sub