PDA

View Full Version : Saving Form Control Properties



GreenMonkey
04-20-2011, 04:24 PM
I'm working on some forms that have a number of unbound toggle buttons. When the button is clicked and becomes active, the caption of the toggle button changes from "" to "X". I'd like to be able to save the changes to the form properties on exit, but it's apparently beyond me. (Although I do have one form that manages to save the changes...but I can't figure out why or what the difference is between that form and the rest!) I've even tried opening the forms in design mode...

Anyway, here's some of the code:

Private Sub cmdNo_Click()
'To open the form in design mode...
DoCmd.OpenForm "frmEPDocs", View:=acDesign
End Sub

Private Sub tgbEGTRRA2001_Click()
'To toggle between caption "" and "X" for a control on frmEPDocs...
If Me.tgbEGTRRA2001.Value = -1 Then
Me.tgbEGTRRA2001.Caption = "X"
Else
Me.tgbEGTRRA2001.Caption = ""
End If
End Sub

Private Sub cmdYes_Click()
'To close the form, saving the changes to the properties,_
'and then exit Access...
DoCmd.Close acForm, "frmEPDocs", acSaveYes
DoCmd.Quit
End Sub

Any help would be greatly appreciated. Thanks.

SoftwareMatt
05-04-2011, 08:25 AM
There may be a good reason for doing it this way but I'm sure it would be easier to use a bound control.

GreenMonkey
05-04-2011, 01:58 PM
Hi, JD. Yes...that's what I ended up doing. It works much better now. :) Thanks for the response, though.