PDA

Click to See Complete Forum and Search --> : New to VBA Please help


pbuddy_8
Feb 19th, 2005, 08:47 PM
Hello,

I'm new to VBA so want some help in MS Access. I've made three tables

Company
Order
Transaction

Company contains all details of company. Order contains bill no, bill date and total bill amount and Transaction contains Sno,Particulars, rate, qty and amount. I've set the respective relationships i.e. one-to-many between Company and Order and one-to-many between Order and Transaction. I've made a order form with transcation sub form so that I can enter whole bill details and save it to the tables. Now I want a print preview of this using report so I made a report and kept a Preview Report button on the Order Form. But, it shows all records from the table the thing I need is that it should show the records from the current bill.

RobDog888
Feb 19th, 2005, 09:30 PM
When you open your report from the preview button on your form, you need
to specify any filter conditions or parameters.

pbuddy_8
Feb 19th, 2005, 10:11 PM
Please give me an example of that

RobDog888
Feb 19th, 2005, 11:49 PM
Private Sub cmdOpenReport_Click()

On Error GoTo Err_Command6_Click
'Run a menu command to filter the form
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 0, , acMenuVer70
'Or Open a report with a where condition to limit the records.
DoCmd.OpenReport "MyReport", acViewPreview, , "ReportID = 888"
Exit_Command6_Click:
Exit Sub

Err_Command6_Click:
MsgBox Err.Description
Resume Exit_Command6_Click

End Sub

pbuddy_8
Feb 20th, 2005, 05:33 AM
Superb Thanks a lot

RobDog888
Feb 20th, 2005, 11:32 AM
No prob.

The where condition in the OpenReport method is like a SQL where clause
without the word "Where". ;)