R
Richard Horne
I have the following code which when clicked on previews a report. The code
basically checks all required fields are filled in, if they are it bookmarks
the current record, then refreshes the set of fields and then displays the
report.
The problem is I always get an "object required" error message, but the
report is still displayed properly? :S
Private Sub View_Customer_Confirmation_Full_Click()
On Error GoTo Err_View_Customer_Confirmation_Full_Click
If IsNull(Me!OrderDate) Then
MsgBox "Please enter the date this order was placed. For today's date hold
down CTRL and press ;."
Me.Order_Entry_Complete = False
Exit Sub
End If
If IsNull(Me!HIE) Then
MsgBox "Please select the order type from the HIE drop down list."
Me.Order_Entry_Complete = False
Exit Sub
End If
If IsNull(Me!Contact) Then
MsgBox "Please enter the Wyedean Contact against this order."
Me.Order_Entry_Complete = False
Exit Sub
End If
If IsNull(Me!DeliveryTerms) Then
MsgBox "Please select the delivery terms against this order."
Me.Order_Entry_Complete = False
Exit Sub
End If
If IsNull(Me!CustomersOrderNumber) Then
MsgBox "Please enter the customers' order number."
Me.Order_Entry_Complete = False
Exit Sub
End If
Dim stDocName As String
Dim rst As DAO.Recordset
Dim lngID As Long
lngID = OrderNumber
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[OrderNumber] = " & lngID
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
rst.Close
Set rst = Nothing
stDocName = "Customer_Confirmation_Full"
DoCmd.OpenReport stDocName, acPreview, , "[OrderNumber] = " &
Me![OrderNumber]
rs.Close
Set rs = Nothing
Exit_View_Customer_Confirmation_Full_Cli:
Exit Sub
Err_View_Customer_Confirmation_Full_Click:
MsgBox Err.Description
Resume Exit_View_Customer_Confirmation_Full_Cli
End Sub
basically checks all required fields are filled in, if they are it bookmarks
the current record, then refreshes the set of fields and then displays the
report.
The problem is I always get an "object required" error message, but the
report is still displayed properly? :S
Private Sub View_Customer_Confirmation_Full_Click()
On Error GoTo Err_View_Customer_Confirmation_Full_Click
If IsNull(Me!OrderDate) Then
MsgBox "Please enter the date this order was placed. For today's date hold
down CTRL and press ;."
Me.Order_Entry_Complete = False
Exit Sub
End If
If IsNull(Me!HIE) Then
MsgBox "Please select the order type from the HIE drop down list."
Me.Order_Entry_Complete = False
Exit Sub
End If
If IsNull(Me!Contact) Then
MsgBox "Please enter the Wyedean Contact against this order."
Me.Order_Entry_Complete = False
Exit Sub
End If
If IsNull(Me!DeliveryTerms) Then
MsgBox "Please select the delivery terms against this order."
Me.Order_Entry_Complete = False
Exit Sub
End If
If IsNull(Me!CustomersOrderNumber) Then
MsgBox "Please enter the customers' order number."
Me.Order_Entry_Complete = False
Exit Sub
End If
Dim stDocName As String
Dim rst As DAO.Recordset
Dim lngID As Long
lngID = OrderNumber
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[OrderNumber] = " & lngID
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
rst.Close
Set rst = Nothing
stDocName = "Customer_Confirmation_Full"
DoCmd.OpenReport stDocName, acPreview, , "[OrderNumber] = " &
Me![OrderNumber]
rs.Close
Set rs = Nothing
Exit_View_Customer_Confirmation_Full_Cli:
Exit Sub
Err_View_Customer_Confirmation_Full_Click:
MsgBox Err.Description
Resume Exit_View_Customer_Confirmation_Full_Cli
End Sub