Private Sub open_report_Click()
On Error GoTo Err_open_report_Click
Dim stDocName As String
Dim stLinkCriteria As String
If Forms![frm_problem]![sfrm_problem_report].Form![Report_ID] <> 0 Then
stDocName = "frm_report_review"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
If IsNull(Forms.frm_problem.Responsibility_ID) Then
MsgBox "You have not attributed responsibility"
End If
If (Forms.frm_problem_amend.Responsibility_ID) = 1 Then
stDocName = "frm_new_report"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End If
Exit_open_scar_Click:
Exit Sub
Err_open_scar_Click:
MsgBox Err.Description
Resume Exit_open_scar_Click
End Sub
So, i thought this would work by if there is a record in sfrm_problem_report, i.e. report_ID is not null, then it will see if responsibility has been assigned and if yes, then it'll open frm_new_report instead. Doesn't work. i get "you entered an expression that has no value". the first bit works, but not the "else" bit. i.e. if there are records present in the subform, then review report opens, but error message if there are no records in the subform.
please help!
cheers, Rob
On Error GoTo Err_open_report_Click
Dim stDocName As String
Dim stLinkCriteria As String
If Forms![frm_problem]![sfrm_problem_report].Form![Report_ID] <> 0 Then
stDocName = "frm_report_review"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
If IsNull(Forms.frm_problem.Responsibility_ID) Then
MsgBox "You have not attributed responsibility"
End If
If (Forms.frm_problem_amend.Responsibility_ID) = 1 Then
stDocName = "frm_new_report"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End If
Exit_open_scar_Click:
Exit Sub
Err_open_scar_Click:
MsgBox Err.Description
Resume Exit_open_scar_Click
End Sub
So, i thought this would work by if there is a record in sfrm_problem_report, i.e. report_ID is not null, then it will see if responsibility has been assigned and if yes, then it'll open frm_new_report instead. Doesn't work. i get "you entered an expression that has no value". the first bit works, but not the "else" bit. i.e. if there are records present in the subform, then review report opens, but error message if there are no records in the subform.
please help!
cheers, Rob