WHen I click the cmdButton with the code below the first time on a new record, the save processes, but the OpenReport does not. If the user clicks the cmdButton a 2nd time, the OpenReport works. Any tips on what I've done wrong in my code so that the save goes and then the OpenReport follows?
Private Sub cmdPrnFinal_Click()
On Error GoTo Err_cmdPrnFinal_Click
Dim stDocName, strWhere As String
If Me.Dirty = True Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
MsgBox "Record has been saved.", vbOKOnly, "Saved Record"
Else
stDocName = "rptWAFinREp"
If Not IsNull(Me.WAID) Then
strWhere = "WAID = " & Me.WAID
Else: Exit Sub
End If
DoCmd.OpenReport stDocName, acViewPreview, , strWhere
End If
Exit_cmdPrnFinal_Click:
Exit Sub
Err_cmdPrnFinal_Click:
MsgBox Err.Description
Resume Exit_cmdPrnFinal_Click
End Sub
Private Sub cmdPrnFinal_Click()
On Error GoTo Err_cmdPrnFinal_Click
Dim stDocName, strWhere As String
If Me.Dirty = True Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
MsgBox "Record has been saved.", vbOKOnly, "Saved Record"
Else
stDocName = "rptWAFinREp"
If Not IsNull(Me.WAID) Then
strWhere = "WAID = " & Me.WAID
Else: Exit Sub
End If
DoCmd.OpenReport stDocName, acViewPreview, , strWhere
End If
Exit_cmdPrnFinal_Click:
Exit Sub
Err_cmdPrnFinal_Click:
MsgBox Err.Description
Resume Exit_cmdPrnFinal_Click
End Sub