D
Don
I am trying to run this code in the On Close or the On Unload event of my form:
Private Sub Form_Unload(Cancel As Integer)
If IsNull(Me.PrintDate) And IsNull(Me.Date) Then
Else
If IsNull(Me.PrintDate) Then
Me.[PrintDate] = Now
Me.DidNotPrint = "Yes"
End If
End If
End Sub
The purpose is to document that the form's data was not printed via the
submit button on the form. If the user closes the form by the close X then I
want the PrintDate to record todays date and I want the DidNotPrint to be
"Yes". What I am getting is a Runtime Error "-2147352567 (800200009)": You
can't assign a value to this object. The funny thing is it will run without
an error at first then after the first order submitted, the next submit or
attempt to close the form results in the above message. I have similar code
that runs in the the Quit button using the following code:
Private Sub Command27_Click()
On Error GoTo Err_Command27_Click
Dim stDocName As String
If IsNull(Me.PrintDate) And IsNull(Me.Date) Then
stDocName = "Quit"
DoCmd.RunMacro stDocName
Else
If IsNull(Me.PrintDate) Then
Me.PrintDate = Now
Me.DidNotPrint = "Yes"
stDocName = "Quit"
DoCmd.RunMacro stDocName
End If
End If
Exit_Command27_Click:
Exit Sub
Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click
End Sub
What might be the problem?
Private Sub Form_Unload(Cancel As Integer)
If IsNull(Me.PrintDate) And IsNull(Me.Date) Then
Else
If IsNull(Me.PrintDate) Then
Me.[PrintDate] = Now
Me.DidNotPrint = "Yes"
End If
End If
End Sub
The purpose is to document that the form's data was not printed via the
submit button on the form. If the user closes the form by the close X then I
want the PrintDate to record todays date and I want the DidNotPrint to be
"Yes". What I am getting is a Runtime Error "-2147352567 (800200009)": You
can't assign a value to this object. The funny thing is it will run without
an error at first then after the first order submitted, the next submit or
attempt to close the form results in the above message. I have similar code
that runs in the the Quit button using the following code:
Private Sub Command27_Click()
On Error GoTo Err_Command27_Click
Dim stDocName As String
If IsNull(Me.PrintDate) And IsNull(Me.Date) Then
stDocName = "Quit"
DoCmd.RunMacro stDocName
Else
If IsNull(Me.PrintDate) Then
Me.PrintDate = Now
Me.DidNotPrint = "Yes"
stDocName = "Quit"
DoCmd.RunMacro stDocName
End If
End If
Exit_Command27_Click:
Exit Sub
Err_Command27_Click:
MsgBox Err.Description
Resume Exit_Command27_Click
End Sub
What might be the problem?