Print preview

G

Guest

I would like to be able to preview before I print. I added a command button
for print preview but when I click on it the page isn't the one that I just
was on. If I arrow at the page number I can find it but why isn't it the
last page that I was on? I someone could help me with this I greatly
appreciate it. Thanks in Advance.
Maggie
 
R

Rick B

What do you mean by the page you were on? Do you want it to go to the point
in the report where the record you were viewing is displayed? Not sure if
that could be done.
 
G

Guest

Rick B,
Yes. I have a form that I enter the data in. I have a command button to
preview the report from the form. When I click on preview it shows a
different report. If you go to the arrows where the page number is you
scroll until you find the report. I would like it to open on the report so
I don't have to go looking for it. If this can't be done can a parameter
value be done and if so how would I do this? Thanks again
Maggie
 
R

Rick B

I know how to open the report so that it ONLY includes the record you were
viewing, but I don't know how to open the report with all data, then jump to
the page that matches the record you were viewing.

If you want to filter the report so that it only includes the current
record, you can use the code posted at the end of this post.

If you still want the entire report, but you want to find the page that
includes the current record, perhaps someone else will be able to help.


Button to print specific record
Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html

See also: http://www.databasedev.co.uk/print_form_record.html
 
G

Guest

Maggie

I am new to acces but I think what you want is a filter query. Basically
take the query you used for your report and make a copy of it and add
"Filter" to the name.

YourQuery Filter

then what you want to do is take the fields that make that record unique and
add this in the criteria

[Forms]![YourFormName]![YourfieldsName]

Then Onclick of your button add , "YourQueryName Filter"

it should look something like this

DoCmd.OpenReport stDocName, acPreview, "Quote Filter"

This will open up the report based on the fields you have entered as criteria?

Does that help?
 
G

Guest

Actually I think the Northwind mdb has an example of what I am talking about
look at the querries in there.
 
G

Guest

Maggie, if I understand you correctly, what you want is to be on a FORM, then
Click Preview Report and have it display the information from the record
(Form) you were just working on?

If so, try this, on the Command button to Preview the Report:

Me.Refresh ' this forces a disk write
DoCmd.OpenReport "rptNAME", acPreview, , "id = " & Me!id

I am fairly new as well so don't me to it, but I think it should work.

/r
Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top