Need command buttons to select info from screen - not working

J

jwr

I have a form "Orders by Customer". I have command buttons at the bottom of
the form:

Orders
Payments
Preview Invoice
Print Packing List
Bill of Lading
Authorization to Deliver
Close Form

Below is the event procedure. My preview invoice, payments and packing list
pull the information for the customerID and controlNumber that is visible on
the screen. The others - Bill of Lading and Authorization to Deliver - to
not. What have I done wrong??? Thanks in advance.


Private Sub PreviewInvoice_Click()
On Error GoTo Err_PreviewInvoice_Click
If Forms![Orders by Customer]![Orders by Customer
Subform].Form.RecordsetClone.RecordCount = 0 Then
MsgBox "Enter order information before previewing invoice."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.OpenReport "Invoice", acPreview, , "[OrderID] = Forms![Orders
by Customer]![Orders by Customer Subform].form![OrderID]"
End If

Exit_PreviewInvoice_Click:
Exit Sub

Err_PreviewInvoice_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resume Exit_PreviewInvoice_Click
End Sub






Private Sub Close_Form_Click()
On Error GoTo Err_Close_Form_Click


DoCmd.Close

Exit_Close_Form_Click:
Exit Sub

Err_Close_Form_Click:
MsgBox Err.Description
Resume Exit_Close_Form_Click

End Sub
Private Sub Command41Pkg_List_Rpt_Click()
On Error GoTo Err_Command41Pkg_List_Rpt_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Packing List"
Me.Dirty = False

stLinkCriteria = "[CustomerID]=" & Me![CustomerID]
DoCmd.OpenReport stDocName, , , stLinkCriteria

Exit_Command41Pkg_List_Rpt_Click:
Exit Sub

Err_Command41Pkg_List_Rpt_Click:
MsgBox Err.Description
Resume Exit_Command41Pkg_List_Rpt_Click

End Sub
Private Sub Command44Auth_to_Deliver_Click()
On Error GoTo Err_Command44Auth_to_Deliver_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Authorization to Deliver Snapshot Form"
Me.Dirty = False
stLinkCriteria = "[CustomerID]=" & Me![CustomerID]

DoCmd.OpenReport stDocName, , , stLinkCriteria

Exit_Command44Auth_to_Deliver_Click:
Exit Sub

Err_Command44Auth_to_Deliver_Click:
MsgBox Err.Description
Resume Exit_Command44Auth_to_Deliver_Click

End Sub
Private Sub Command45_Click()
On Error GoTo Err_Command45_Click

Dim stDocName As String

stDocName = "Bill of lading"
DoCmd.OpenReport stDocName, acNormal

Exit_Command45_Click:
Exit Sub

Err_Command45_Click:
MsgBox Err.Description
Resume Exit_Command45_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top