T
Trini Gal
I have a form with a close button with the following code.
Private Sub btnCCRClose_Click()
On Error GoTo Err_btnCCRClose_Click
Dim ctl As Control
For Each ctl In Me.Detail.Controls
If ctl.Tag = "Required" Then
If Trim(ctl & "") = "" Then
Cancel = True
MsgBox ctl.Name & " is a Required Entry.", vbCritical, "REQUIRED
ENTRY"
ctl.SetFocus
Exit Sub
End If
End If
Next ctl
DoCmd.Close
Exit_btnCCRClose_Click:
Exit Sub
Err_btnCCRClose_Click:
MsgBox Err.Description
Resume Exit_btnCCRClose_Click
End Sub
It worked fine on Friday when I added the code, but now, I’m getting an
error “Object doesn’t support this property or methodâ€.
I originally had the code in the BEFORE UPDATE event of the form. When I
opened it and tried to close it leaving blank, only one “Required Entryâ€
error would pop up and then it would close anyways, without saving the record.
Can someone please help me or tell me what I’m doing wrong?
Thanks.
Private Sub btnCCRClose_Click()
On Error GoTo Err_btnCCRClose_Click
Dim ctl As Control
For Each ctl In Me.Detail.Controls
If ctl.Tag = "Required" Then
If Trim(ctl & "") = "" Then
Cancel = True
MsgBox ctl.Name & " is a Required Entry.", vbCritical, "REQUIRED
ENTRY"
ctl.SetFocus
Exit Sub
End If
End If
Next ctl
DoCmd.Close
Exit_btnCCRClose_Click:
Exit Sub
Err_btnCCRClose_Click:
MsgBox Err.Description
Resume Exit_btnCCRClose_Click
End Sub
It worked fine on Friday when I added the code, but now, I’m getting an
error “Object doesn’t support this property or methodâ€.
I originally had the code in the BEFORE UPDATE event of the form. When I
opened it and tried to close it leaving blank, only one “Required Entryâ€
error would pop up and then it would close anyways, without saving the record.
Can someone please help me or tell me what I’m doing wrong?
Thanks.