Hi. I have a form named [OKIL Main Screen] (which I didn't name) and it's opened from two different "On Click" event procedures as 1) data entry only or 2) to view/edit data. When opened for data entry, I use this code, which works fine as far as the field values being null.
Code:
Private Sub DataEntry_Click()On Error GoTo Err_DataEntry_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "OKIL Main Screen"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Exit_DataEntry_Click:
Exit Sub
Err_DataEntry_Click:
MsgBox Err.Description
Resume Exit_DataEntry_Click
End Sub
My problem is this: when the form opens as data entry, some label formatting has not been reset. I'd like to set the formatting as
Code:
Me.Label403.ForeColor = vbBlack
Me.boxSSBenefit.Visible = False
I'm not sure where to put the formatting reset code. The "Me" reference doesn't work in the "On Click" event proc because I'm not in the "OKIL Main Screen" form, and I don't know if I can even reset the formatting for form objects in the "On Click" event proc. When the form is loaded in view/edit mode, there's a lot of code in the "On Load" event procedure, including some if statements to set the formatting for the same labels, so I'm not sure if putting code for the data entry mode will work here. When I go to the "On Load" event proc in data entry mode, it looks like the same event proc as the view/edit mode (which may be as designed.)
Here's an example of the "On Load" event proc if statements/formatting settings for the view/edit mode, which is working fine.
Code:
If Me.SSBenefit = No Then Me.Label403.ForeColor = vbBlack
Me.boxSSBenefit.Visible = False
Else
Me.Label403.ForeColor = vbWhite
Me.boxSSBenefit.Visible = True
End If
I appreciate your help and consideration.