Bryan Schmidt
asked on
Error message that references an Access 2010 form that is not open
I have an Access 2010 form (frmContributionSingleRec) that is working correctly except for two things. When the Move Record button is clicked the record displayed on the form moves to another table as expected but then a dialogue box opens which prompts me to enter a parameter value for another form. That other form is not open and there is no code behind the open form that makes reference to it. The same thing happens when another button is clicked that is supposed to confirm the record has been moved. None of the queries that run using code behind the form reference the closed form.
Something is obviously referencing the closed form but after reviewing everything connected to the open form I'm stumped. The code behind the Move Record button is shown below.
Private Sub cmdMoveRecord_Click()
Dim strMsg As String
strMsg = IIf(IsNull([Org or Project Name]), " Organization Name" & vbCrLf, Null) & _
IIf(IsNull([Street Address]), " Address" & vbCrLf, Null) & _
IIf(IsNull([City]), " City" & vbCrLf, Null) & _
IIf(IsNull([County]), " County" & vbCrLf, Null) & _
IIf(IsNull([State]), " State" & vbCrLf, Null) & _
IIf(IsNull([Sub Category]), " Sub Category" & vbCrLf, Null) & _
IIf(IsNull([Zip Code]), " Zip Code" & vbCrLf, Null) & _
IIf(IsNull([Loan Number]), " Loan Number" & vbCrLf, Null) & _
IIf(IsNull([Dollar Amount]), " Amount" & vbCrLf, Null) & _
IIf(IsNull([Activity Date]), " Activity Date" & vbCrLf, Null) & _
IIf(IsNull([AA]), " Assessment Area" & vbCrLf, Null) & _
IIf(IsNull([Program project Description]), " Program Project Description" & vbCrLf, Null) & _
IIf(IsNull([Qualifying Criteria Bonds TxCr]), " Qualifying Criteria For CARS" & vbCrLf, Null) & _
IIf(IsNull([ReviewedBy]), " Reviewed By", Null) & _
""
If [ApprovalStatus] = "Pending" Then
If Me.Dirty Then Me.Dirty = False
MsgBox "Record saved as pending, but some fields may still be empty." & vbCrLf & _
"When approving or rejecting a record, all required fields must be populated."
Exit Sub
End If
'Everyting below this line doesn't change
If Len(strMsg) Then 'If there is a length something is required, if Len() = 0 then go for save
MsgBox "Some required fields are still empty. They are..." & vbCrLf & vbCrLf & _
strMsg, vbCritical, " Save Canceled"
Exit Sub
Else
If Me.Dirty Then 'If the record has been modified
Me.Dirty = False 'Then save it
MsgBox "Record Saved", , " Record Saved"
End If
End If
On Error Resume Next
Select Case MsgBox("Please confirm you want to move this record to the main table (if approved) or reject table for contributions", _
vbYesNo + vbDefaultButton2)
Case vbYes
MsgBox "Record moved"
Case vbNo
MsgBox "Action Canceled"
Exit Sub
End Select
DoCmd.SetWarnings False
RunCommand acCmdSelectRecord
If [ApprovalStatus] = "Approved" Then
DoCmd.OpenQuery "qappContributionsToMainTa ble"
ElseIf [ApprovalStatus] = "Reject" Then
DoCmd.OpenQuery "qappTblContributionsRejec t"
End If
End Sub
The code behind the button that confirms the record was moved is shown below.
Private Sub cmdRun_Click()
If IsNull(Me.cboReviewedBy.Va lue) Then
MsgBox "Please select a CDA from the Reviewed By box"
Me.cboReviewedBy.SetFocus
Exit Sub
End If
On Error Resume Next
DoCmd.OpenReport "rptContributionsMovedToda y", acViewPreview
Reports("rptContributionsM ovedToday" ).ZoomCont rol = 100
End Sub
Any suggestions on how to troubleshoot this would be appreciated.
Something is obviously referencing the closed form but after reviewing everything connected to the open form I'm stumped. The code behind the Move Record button is shown below.
Private Sub cmdMoveRecord_Click()
Dim strMsg As String
strMsg = IIf(IsNull([Org or Project Name]), " Organization Name" & vbCrLf, Null) & _
IIf(IsNull([Street Address]), " Address" & vbCrLf, Null) & _
IIf(IsNull([City]), " City" & vbCrLf, Null) & _
IIf(IsNull([County]), " County" & vbCrLf, Null) & _
IIf(IsNull([State]), " State" & vbCrLf, Null) & _
IIf(IsNull([Sub Category]), " Sub Category" & vbCrLf, Null) & _
IIf(IsNull([Zip Code]), " Zip Code" & vbCrLf, Null) & _
IIf(IsNull([Loan Number]), " Loan Number" & vbCrLf, Null) & _
IIf(IsNull([Dollar Amount]), " Amount" & vbCrLf, Null) & _
IIf(IsNull([Activity Date]), " Activity Date" & vbCrLf, Null) & _
IIf(IsNull([AA]), " Assessment Area" & vbCrLf, Null) & _
IIf(IsNull([Program project Description]), " Program Project Description" & vbCrLf, Null) & _
IIf(IsNull([Qualifying Criteria Bonds TxCr]), " Qualifying Criteria For CARS" & vbCrLf, Null) & _
IIf(IsNull([ReviewedBy]), " Reviewed By", Null) & _
""
If [ApprovalStatus] = "Pending" Then
If Me.Dirty Then Me.Dirty = False
MsgBox "Record saved as pending, but some fields may still be empty." & vbCrLf & _
"When approving or rejecting a record, all required fields must be populated."
Exit Sub
End If
'Everyting below this line doesn't change
If Len(strMsg) Then 'If there is a length something is required, if Len() = 0 then go for save
MsgBox "Some required fields are still empty. They are..." & vbCrLf & vbCrLf & _
strMsg, vbCritical, " Save Canceled"
Exit Sub
Else
If Me.Dirty Then 'If the record has been modified
Me.Dirty = False 'Then save it
MsgBox "Record Saved", , " Record Saved"
End If
End If
On Error Resume Next
Select Case MsgBox("Please confirm you want to move this record to the main table (if approved) or reject table for contributions", _
vbYesNo + vbDefaultButton2)
Case vbYes
MsgBox "Record moved"
Case vbNo
MsgBox "Action Canceled"
Exit Sub
End Select
DoCmd.SetWarnings False
RunCommand acCmdSelectRecord
If [ApprovalStatus] = "Approved" Then
DoCmd.OpenQuery "qappContributionsToMainTa
ElseIf [ApprovalStatus] = "Reject" Then
DoCmd.OpenQuery "qappTblContributionsRejec
End If
End Sub
The code behind the button that confirms the record was moved is shown below.
Private Sub cmdRun_Click()
If IsNull(Me.cboReviewedBy.Va
MsgBox "Please select a CDA from the Reviewed By box"
Me.cboReviewedBy.SetFocus
Exit Sub
End If
On Error Resume Next
DoCmd.OpenReport "rptContributionsMovedToda
Reports("rptContributionsM
End Sub
Any suggestions on how to troubleshoot this would be appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You're welcome. I seem to have a good memory for my own time consuming mistakes. If only I could stop making them :)
ASKER
Thank you very much! I was only checking the QBE grid until you reminded me to look at the parameters property of the queries. That fixed it. Very much appreciated!