I have a main form with tabs. On the third tab I have two subforms which are invisible. There are two checkboxes on the mainform. Each checkbox makes one of the two forms visible. When a form becomes visible, data can be added to the form and is put into a table upon clicking the Save button. I would like the Save button click to also make the form invisible once again.
This is the code I have on the main form:
Private Sub epsinspcheck_AfterUpdate()
'After Update of checkbox Check if Active checkbox is selected then show or hide subform
If Me.EPSInspCheck = True Then
Me.sfinspeps.Visible = True
Else
Me.sfinspeps.Visible = False
End If
'disables conditions/repaircheck if epscheck is selected
If Me.EPSInspCheck = True Then
Me.conditionrepaircheck.Enabled = False
Else
Me.conditionrepaircheck.Enabled = True
End If
End Sub
Private Sub conditionrepaircheck_afterupdate()
'After Update of checkbox Check if Active checkbox is selected then show or hide subform
If Me.conditionrepaircheck = True Then
Me.sfEPSConditionsRepairs.Visible = True
Else
Me.sfEPSConditionsRepairs.Visible = False
End If
'disables epscheck if conditions/repairs check is selected
If Me.conditionrepaircheck = True Then
Me.EPSInspCheck.Enabled = False
Else
Me.EPSInspCheck.Enabled = True
End If
End Sub
Private Sub Form_Current()
'On current event of main form Check if Active checkbox is selected then show or hide subform
If Me.EPSInspCheck = True Then
Me.sfinspeps.Visible = True
Else
Me.sfinspeps.Visible = False
End If
If Me.conditionrepaircheck = True Then
Me.sfEPSConditionsRepairs.Visible = True
Else
Me.sfEPSConditionsRepairs.Visible = False
End If
End Sub
This is the code I have on the subform
Private Sub bSave_Click()
On Error GoTo Err_BSAVE_Click
'Saves current record and closes form
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Forms!sfinspeps.Visible = False
Exit_BSAVE_Click:
Exit Sub
Err_BSAVE_Click:
MsgBox Err.Description
Resume Exit_BSAVE_Click
End Sub
Private Sub bCancel_Click()
On Error GoTo Err_bCancel_Click
'Looks for changes/edits and undoes them
If Me.Dirty Then
Me.Undo
End If
'Closes form
Forms![sfinspeps].Visible = False
Exit_bCancel_Click:
Exit Sub
Err_bCancel_Click:
MsgBox Err.Description
Resume Exit_bCancel_Click
End Sub
I get the error that Access can't find the form sfinspeps referred to in the code. I have also tried variations.
Help would be apprecited.
Thanks
This is the code I have on the main form:
Private Sub epsinspcheck_AfterUpdate()
'After Update of checkbox Check if Active checkbox is selected then show or hide subform
If Me.EPSInspCheck = True Then
Me.sfinspeps.Visible = True
Else
Me.sfinspeps.Visible = False
End If
'disables conditions/repaircheck if epscheck is selected
If Me.EPSInspCheck = True Then
Me.conditionrepaircheck.Enabled = False
Else
Me.conditionrepaircheck.Enabled = True
End If
End Sub
Private Sub conditionrepaircheck_afterupdate()
'After Update of checkbox Check if Active checkbox is selected then show or hide subform
If Me.conditionrepaircheck = True Then
Me.sfEPSConditionsRepairs.Visible = True
Else
Me.sfEPSConditionsRepairs.Visible = False
End If
'disables epscheck if conditions/repairs check is selected
If Me.conditionrepaircheck = True Then
Me.EPSInspCheck.Enabled = False
Else
Me.EPSInspCheck.Enabled = True
End If
End Sub
Private Sub Form_Current()
'On current event of main form Check if Active checkbox is selected then show or hide subform
If Me.EPSInspCheck = True Then
Me.sfinspeps.Visible = True
Else
Me.sfinspeps.Visible = False
End If
If Me.conditionrepaircheck = True Then
Me.sfEPSConditionsRepairs.Visible = True
Else
Me.sfEPSConditionsRepairs.Visible = False
End If
End Sub
This is the code I have on the subform
Private Sub bSave_Click()
On Error GoTo Err_BSAVE_Click
'Saves current record and closes form
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Forms!sfinspeps.Visible = False
Exit_BSAVE_Click:
Exit Sub
Err_BSAVE_Click:
MsgBox Err.Description
Resume Exit_BSAVE_Click
End Sub
Private Sub bCancel_Click()
On Error GoTo Err_bCancel_Click
'Looks for changes/edits and undoes them
If Me.Dirty Then
Me.Undo
End If
'Closes form
Forms![sfinspeps].Visible = False
Exit_bCancel_Click:
Exit Sub
Err_bCancel_Click:
MsgBox Err.Description
Resume Exit_bCancel_Click
End Sub
I get the error that Access can't find the form sfinspeps referred to in the code. I have also tried variations.
Help would be apprecited.
Thanks