Printing forms

S

Sheri

Hi,
I created a form it works very well but when I go to
print it prints everything. I would like for it to print
only the page I selected.At the bottom of the form there
is a record keeper is there a way that I could dim the
recordas whereas as when I click print preview it will
only print that form. Please help me!!!

Thanks

Sheri
 
D

Duane Hookom

Is there a reason you are printing a form (meant for data entry, viewing,
and navigation) rather than creating a report? I believe you can save a form
as a report and then make modifications to the design of the new report.
 
G

Guest

Yes, I kept track on all employee accidents and workman
comp. I print the form to give one to the administrative
so that he could have a hard copy. Even if I try to print
a report it does not print the selected report it prints
them all.
 
D

Duane Hookom

You can limit the records in a report by:
-adding a criteria to the query that is the report's record source
-opening the report with a where clause in the OpenReport line of code
-other...
 
G

Guest

Sorry but I did not understand the last statement, you
mean openreport line of code other .. in the macro, other
is in the property ....can you please explain better
 
D

Duane Hookom

I would use the wizard to add code to your form to open the report. Then
modify the code which might look like this...
Dim stDocument as String
Dim strWhere as String
stDocument = "rptYourReportName"
strWhere = "[YourPKField]=" & Me.txtPKField
DoCmd.OpenReport stDocument, acPreview, , strWhere

I don't know what your unique field is that you want to filter the report on
or your report name.
 
S

Sheri

Thanks, That help it does exactly what I want, print the
first page only. Again thanks.
-----Original Message-----
I would use the wizard to add code to your form to open the report. Then
modify the code which might look like this...
Dim stDocument as String
Dim strWhere as String
stDocument = "rptYourReportName"
strWhere = "[YourPKField]=" & Me.txtPKField
DoCmd.OpenReport stDocument, acPreview, , strWhere

I don't know what your unique field is that you want to filter the report on
or your report name.

--
Duane Hookom
MS Access MVP
--

Sorry but I did not understand the last statement, you
mean openreport line of code other .. in the macro, other
is in the property ....can you please explain better design
of dim
the


.
 
Top