Link report results to check box on form?

Garindan

Registered User.
Local time
Today, 09:02
Joined
May 25, 2004
Messages
250
Could someone help me with this? I have a built a report (rptOrderDeliveries) to display and print Customer Orders.

I have a form (frmOrderProcessing) which displays unprocessed orders. There is a check box on the form for which the control source is a 'ProcessedForDelivery' Yes/No field. The orders are displayed as continuous forms and the user selects which orders they want to add to the delivery using the check boxes. Then there's a command buttom to open the report.

I would like to set it up so the report shows the records which have been selected by the user.

The form runs on a query which only shows unprocessed orders, so tblCustomerOrders has a 'ProcessedForDelivery' Yes/No field, and qselUnprocessedOrders has a No criteria in this field.

The report runs on a very similar query with the yes/no field but it has an extra table which I dont want in qselUnprocessedOrders (as it displays more records) so the report and form run on different queries, but they both have 'ProcessedForDelivery' field and an 'OrderNumber' field.

I'm thinking I need to link the report record 'OrderNumber' to form record 'OrderNumber' where 'ProcessedForDelivery' = True (or -1). Am I correct with this?

I'm not quite sure how though and was wondering if someone could help.

I would like the command button to open the report with the selected records from the form, and then requery the form (is this right?) to remove those selected records.

The code I have on the command button at the mo is
Code:
Private Sub btnOpenDelivRpt_Click()

  'Send selected records to delivery report.

  If Me!txtSelected = 0 Then

    MsgBox "Please select an Order to print", vbOKOnly, "Error: No Orders selected"

  Else

    DoCmd.OpenReport "rptOrderDeliveries", acViewPreview

  End If

  Exit Sub

End Sub
 

Users who are viewing this thread

Back
Top Bottom