G
george 16-17
Greetings all,
I am fairly new to Access and currently using Access 2003. I need some
assistance coding a subform(subfrmEmpHistory) that updates the main form
(frmEmpDemo). The problem I am having is how the handle the required subform
text boxes if left incomplete, I would like the textbox backcolor to
hightlight it in red. I was able to do this with conditional formatting, but
is there code for this?
This is my current code:
Private Sub Form_AfterUpdate()
On Error GoTo Err_Handler
Dim ctl As Control
If Not IsNull(ctlControlType) Then
If Me.Dirty Then
Me.Dirty = False
End If
With Forms!frmEmpDemo
!txtJobTitleEmpDemo = Me.txtNewJobTitle.Value
!txtDepartmentEmpDemo = Me.txtNewDepartment.Value
!cboWorkStatusEmpDemo = Me.txtNewWorkStatus.Value
End With
End If
If IsNull(ctlControlType) Then
.BackColor = 255 'This code is not working.
End With
End If
Forms!frmEmpDemo.Requery
Forms!frmEmpDemo.Refresh
Exit Sub
Err_Handler:
MsgBox "Please enter requested information. " & Error, vbOKOnly, "Required
field!"
End Sub
Thanks in advance,
george
I am fairly new to Access and currently using Access 2003. I need some
assistance coding a subform(subfrmEmpHistory) that updates the main form
(frmEmpDemo). The problem I am having is how the handle the required subform
text boxes if left incomplete, I would like the textbox backcolor to
hightlight it in red. I was able to do this with conditional formatting, but
is there code for this?
This is my current code:
Private Sub Form_AfterUpdate()
On Error GoTo Err_Handler
Dim ctl As Control
If Not IsNull(ctlControlType) Then
If Me.Dirty Then
Me.Dirty = False
End If
With Forms!frmEmpDemo
!txtJobTitleEmpDemo = Me.txtNewJobTitle.Value
!txtDepartmentEmpDemo = Me.txtNewDepartment.Value
!cboWorkStatusEmpDemo = Me.txtNewWorkStatus.Value
End With
End If
If IsNull(ctlControlType) Then
.BackColor = 255 'This code is not working.
End With
End If
Forms!frmEmpDemo.Requery
Forms!frmEmpDemo.Refresh
Exit Sub
Err_Handler:
MsgBox "Please enter requested information. " & Error, vbOKOnly, "Required
field!"
End Sub
Thanks in advance,
george