printing a form to a report

gilescis

D. Castaldo
Local time
Today, 02:47
Joined
Jan 23, 2006
Messages
106
I have a form (entry screen to enter data) I then created a report in the layout I need for my order form. I want to creat a button that a user can press and it will print the current record to the report (order form layout)

Here is my current code for the print button on the form page:
Private Sub btnPrtOrderFrm_Click()
On Error GoTo Err_btnPrtOrderFrm_Click

Dim stDocName As String

stDocName = "rptOrders2"
DoCmd.OpenReport stDocName, acNormal

Exit_btnPrtOrderFrm_Click:
Exit Sub

Err_btnPrtOrderFrm_Click:
MsgBox Err.Description
Resume Exit_btnPrtOrderFrm_Click

End Sub

The only problem is when I tell it to print if I am on record number 2 on the form, it prints both record 1 and record 2. I only want the current record i am in to print. Any ideas much appreciated

Dean
 
reference the IDNo of the record on screen in the query behind the report. Then you'll just get the one.

Col
 
Here is my SQL Query that the report uses. I want the user to be able to enter the CustID#, that is a unique # to each order.

SELECT tblCustomers.CustID, tblCustomers.gilesCompanyName, tblCustomers.CompanyName, tblCustomers.BillingAddress, tblCustomers.BilltoCity, tblCustomers.BilltoState, tblCustomers.zip, tblCustomers.ContactName, tblCustomers.phone, tblCustomers.ShipName, tblCustomers.shipaddress1, tblCustomers.shipaddress2, tblCustomers.shiptocity, tblCustomers.shiptostate, tblCustomers.shipzip, tblCustomers.trdprtypo, tblCustomers.custpo, tblCustomers.shipvia, tblCustomers.shipfromloc, tblCustomers.RCARNum, tblCustomers.BOLnum, tblCustomers.prepaid, tblCustomers.prepaidadd, tblCustomers.collect, tblCustomers.empname, tblCustomers.specialinstructions, Orders.orderdate, Orders.schedshipdate, Orders.schedreqdate, Orders.Qty, Orders.pounds, Orders.ProductName, Orders.gilesmultiplePO, Orders.custmultiplePO, Orders.SupplyLocation
FROM tblCustomers INNER JOIN Orders ON tblCustomers.CustID = Orders.CustID
WHERE (((tblCustomers.CustID)="Enter ID:[CustID]"));
 

Users who are viewing this thread

Back
Top Bottom