MainForm - MainProspectFrm
SubForm - SubDocTaskListProsp
Forms!MainProspectFrm!SubProspectDocList.Form![CONTRACT].BackColor = RGB(255, 255, 0)
I want to change the Toggle button [contract] "yellow" if previous statement is true
MainForm - MainProspectFrm
SubForm - SubDocTaskListProsp
Forms!MainProspectFrm!SubProspectDocList.Form![CONTRACT].BackColor = RGB(255, 255, 0)
I want to change the Toggle button [contract] "yellow" if previous statement is true
Programmatically changing properties of controls on form only works nice if form is in Single view or the controls are in header/footer of Continuous form.
What is the issue? What happens when this code runs?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Nothing. No error code and the color does not change.
Not sure will make a difference, but I use dot (.) when referencing controls, and bang (!) when referencing fields. Could use vbYellow.
Forms!MainProspectFrm!SubProspectDocList.Form.[CONTRACT].BackColor = vbYellow
What do you mean by 'if previous statement is true'?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks the toggle button still does not change to yellow. I would like for the user to click on the check box which puts up a message box. Based on the result I want to change the color of the toggle button. There are multiple buttons on the subform.
I would like to do this from a click event.
Also my 2 fields CONTRACTREQDATE AND CONTRACTREQEMP are not staying locked once i save/close and open the form once more.
Dim CResponse As Integer
CResponse = MsgBox("Please confirm that you have REQUESTED the CONTRACT?", vbYesNo, "Continue")
If CResponse = vbYes Then
CONTRACTREQDATE = Now()
CONTRACTREQEMP = CurrentUser
CONTRACTREQchk.Value = True
'Forms!MainProspectFrm!SubProspectDocList.Form![CONTRACT].BackColor = RGB(255, 255, 0)
Forms!MainProspectFrm2!SubProspectDocList.Form.[CONTRACT].BackColor = vbYellow
Me.CONTRACTREQDATE.Locked = True
Me.CONTRACTREQEMP.Locked = True
Else
MsgBox "Please Return when you have the correct information", 0, "Gotcha!"
CONTRACTREQDATE = ""
CONTRACTREQEMP = ""
CONTRACT.Value = False
Me.CONTRACTREQDATE.Locked = False
Me.CONTRACTREQEMP.Locked = False
End If
Last edited by Guerra67; 11-18-2014 at 01:18 PM. Reason: more information
If you want the textboxes locked when form opens, need to run the same code that looks at value of checkbox or use Conditional Formatting.
The checkbox is on main form and toggle button is on subform?
I always give subform container control name different from the object it holds, like ctrDocs. Then:
Me.ctrDocs.Form.[CONTRACT].BackColor = vbYellow
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.