This is quite simple. First, you create a report with the appropriate layout. Don't fill in the property of Data/Record Source. You'll specify it in code.
Second, the underlying code of the Print Button command on your form contains code like this:
Dim strSQL as String
strSQL = "SELECT fields FROM table WHERE radioButton = -1"
...
report.RecordSource = strSQL
... open the report ...
Principally, this means that you set the RecordSource property of the report in code. When the report is to be opened, it's RecordSource property is set dynamically in runtime.
The report will show only those records you selected in the form.
If you're a bit handy in VBA, you can manipulate a lot in runtime via code.
I hope this gets you on your way.
Cheers,
Phil Sieben
_______________________________
Quote:
quote:Originally posted by rossmic
I want to print a selected record using a Print button on a Form.
Currently we use the Form to view record contents. When we have the record we wish to print we have to use File | Print then click the Selected Record radio button then OK.
Do any of you know how we can select the current record through code rather than the print dialog.
Cheers,
Michael T. Ross
Software Design Assurance
[email protected]
|