S
Serendipity
I have a form that I created a command button to allow the user to enter
another inspection form from the field. While it clears the majority of the
information from the form, the check boxes that were chosen in the previous
inspection do not reset. If you leave them checked, they do not store in the
new inspection as being chosen, but it confusing for the end user to see
things checked. The form is set to data entry. Each of these checkboxes have
the following VBA code with changes based upon the item chosen. I have also
included the VBA code on the command button. These check boxes are to default
as unchecked as we are only tracking when the condition exists. How do I get
the checkboxes to default to unchecked each time a new inspection is to be
entered? Also, if the form is closed and reopened, they are unchecked, so it
is only a problem when the end user is entering multiple inspections without
closing the form.
Thanks for your help.
Serendipity
VBA on the Check Box:
Private Sub Check96_AfterUpdate()
Dim strSQL As String
If Me.Check96 = True Then
strSQL = "INSERT INTO tblInspectionReportItems " & _
"(InspectionReportID, ReportDetailItemID,UFE) " & _
"VALUES (" & Me.txtInspectionReportID & ", " & _
CLng(Me.Check96.Tag) & ", '" & _
Forms!frmLogin!txtUserName & "') "
Else
strSQL = "DELETE * FROM tblInspectionReportItems " & _
"WHERE InspectionReportID = " & Me.txtInspectionReportID & _
" AND ReportDetailItemID = " & CLng(Me.Check96.Tag) & ";"
End If
CurrentDb.Execute strSQL
End Sub
VBA on the Command Button:
Private Sub CMDEnterNewRoofInspection_Click()
On Error GoTo Err_CMDEnterNewRoofInspection_Click
DoCmd.GoToRecord , , acNewRec
Exit_CMDEnterNewRoofInspection_Click:
Exit Sub
Err_CMDEnterNewRoofInspection_Click:
MsgBox Err.Description
Resume Exit_CMDEnterNewRoofInspection_Click
another inspection form from the field. While it clears the majority of the
information from the form, the check boxes that were chosen in the previous
inspection do not reset. If you leave them checked, they do not store in the
new inspection as being chosen, but it confusing for the end user to see
things checked. The form is set to data entry. Each of these checkboxes have
the following VBA code with changes based upon the item chosen. I have also
included the VBA code on the command button. These check boxes are to default
as unchecked as we are only tracking when the condition exists. How do I get
the checkboxes to default to unchecked each time a new inspection is to be
entered? Also, if the form is closed and reopened, they are unchecked, so it
is only a problem when the end user is entering multiple inspections without
closing the form.
Thanks for your help.
Serendipity
VBA on the Check Box:
Private Sub Check96_AfterUpdate()
Dim strSQL As String
If Me.Check96 = True Then
strSQL = "INSERT INTO tblInspectionReportItems " & _
"(InspectionReportID, ReportDetailItemID,UFE) " & _
"VALUES (" & Me.txtInspectionReportID & ", " & _
CLng(Me.Check96.Tag) & ", '" & _
Forms!frmLogin!txtUserName & "') "
Else
strSQL = "DELETE * FROM tblInspectionReportItems " & _
"WHERE InspectionReportID = " & Me.txtInspectionReportID & _
" AND ReportDetailItemID = " & CLng(Me.Check96.Tag) & ";"
End If
CurrentDb.Execute strSQL
End Sub
VBA on the Command Button:
Private Sub CMDEnterNewRoofInspection_Click()
On Error GoTo Err_CMDEnterNewRoofInspection_Click
DoCmd.GoToRecord , , acNewRec
Exit_CMDEnterNewRoofInspection_Click:
Exit Sub
Err_CMDEnterNewRoofInspection_Click:
MsgBox Err.Description
Resume Exit_CMDEnterNewRoofInspection_Click