SyntaxSocialist
Registered User.
- Local time
- Today, 13:06
- Joined
- Apr 18, 2013
- Messages
- 109
Ok, I've got a form (frmEdit) that allows users to search tblMain for records using a bunch of unbound controls and a dynamically created SQL statement. Search results are displayed in a subform (subMain), and the current record in the subform is displayed in a set of bound controls on frmEdit.
Now the important bit: There is a set of unbound checkboxes on my form that allow the user to change which fields are visible in subMain. This is accomplished by the following:
Certain fields are visible by default, but the user may want to change which fields those are. Here's what I've done so far to accomplish this:
**btnDone changes Forms.frmEdit.Form.chkName.DefaultValue to Me.CorrespondingCheckBox.Value and then closes frmChangeDefaults
This all seems to work quite well, actually. Debugging confirms that the default values of the checkboxes on frmEdit are indeed changed when I click btnDone. But when I close frmEdit and re-open it, the default values return to what they were prior. AUGH! This happens even when:
What am I missing here?:banghead:
Now the important bit: There is a set of unbound checkboxes on my form that allow the user to change which fields are visible in subMain. This is accomplished by the following:
Code:
Private Sub chkName_AfterUpdate()
If Me.chkName = 0 Then
Me.subMain.Form.CorrespondingField.ColumnHidden = True
Else
Me.subMain.Form.CorrespondingField.ColumnHidden = False
End If
End Sub
Certain fields are visible by default, but the user may want to change which fields those are. Here's what I've done so far to accomplish this:
- Created a button (btnChangeDefaults) that opens a form (frmChangeDefaults)
- Put checkboxes for each table field on frmChangeDefaults
- Put a "Cancel" button (btnCancel)* and "Done" button (btnDone)** on frmChangeDefaults.
**btnDone changes Forms.frmEdit.Form.chkName.DefaultValue to Me.CorrespondingCheckBox.Value and then closes frmChangeDefaults
This all seems to work quite well, actually. Debugging confirms that the default values of the checkboxes on frmEdit are indeed changed when I click btnDone. But when I close frmEdit and re-open it, the default values return to what they were prior. AUGH! This happens even when:
- I close frmEdit using DoCmd.Close acForm, "frmEdit", acSaveYes
- I close frmEdit after using DoCmd.Save acForm, "FrmEdit"
- I save frmEdit manually by right-clicking and pressing save
What am I missing here?:banghead: