I have created a custom menu bar that checks for duplicates via before update. This menubar attempts to bypass it however when i close the form and try to open another it keeps giving me the error you cannot modify a new report while another is already being processed.
here is my code:
Private Sub SaveWeekly_Click()
Dim iEmpId As Long
If IsNull(Me.Emp_ID) Then
If (MsgBox("Please enter your Employee ID " & vbCrLf & _
vbCrLf & "Please enter a different date.", _
vbOKOnly, "Duplicate Employee") = vbOKOnly) Then
Cancel = True
End If
End If
If IsNull(Me.[Month/Wk]) Then
If (MsgBox("Are you sure you wish to leave without inputting
information?", vbQuestion + vbYesNo, _
"Confirmation") = vbYes) Then
DoCmd.Close acForm, "EmployeeWeekly"
*****HERE IS WHERE I WANT TO OPEN MENUBAR********
Else:
Cancel = True
End If
Else:
iEmpId = DCount("[Emp_ID]", "tblEmployeeWeekly", "[Emp_ID] =
" & Me.Emp_ID & " And [Month/Wk]='" & Me.[Month/Wk] & "'")
If iEmpId <> 0 Then
If (MsgBox("An entry for this date already exists. " & vbCrLf
& _ vbCrLf & "Please enter a different date.", _
vbOKOnly, "Duplicate Employee") = vbOKOnly) Then
Cancel = True
End If
Else:
DoCmd.Save acForm, "EmployeeWeekly"
DoCmd.OpenForm "EmployeeWeekly"
End If
End If
End Sub
here is my code:
Private Sub SaveWeekly_Click()
Dim iEmpId As Long
If IsNull(Me.Emp_ID) Then
If (MsgBox("Please enter your Employee ID " & vbCrLf & _
vbCrLf & "Please enter a different date.", _
vbOKOnly, "Duplicate Employee") = vbOKOnly) Then
Cancel = True
End If
End If
If IsNull(Me.[Month/Wk]) Then
If (MsgBox("Are you sure you wish to leave without inputting
information?", vbQuestion + vbYesNo, _
"Confirmation") = vbYes) Then
DoCmd.Close acForm, "EmployeeWeekly"
*****HERE IS WHERE I WANT TO OPEN MENUBAR********
Else:
Cancel = True
End If
Else:
iEmpId = DCount("[Emp_ID]", "tblEmployeeWeekly", "[Emp_ID] =
" & Me.Emp_ID & " And [Month/Wk]='" & Me.[Month/Wk] & "'")
If iEmpId <> 0 Then
If (MsgBox("An entry for this date already exists. " & vbCrLf
& _ vbCrLf & "Please enter a different date.", _
vbOKOnly, "Duplicate Employee") = vbOKOnly) Then
Cancel = True
End If
Else:
DoCmd.Save acForm, "EmployeeWeekly"
DoCmd.OpenForm "EmployeeWeekly"
End If
End If
End Sub