PC Review


Reply
Thread Tools Rate Thread

Access Printing

 
 
=?Utf-8?B?TGluZGE=?=
Guest
Posts: n/a
 
      22nd Mar 2007
when I go into my access database and want to print I have to always remember
to click on selected record for it to print only that page or it will print
the whole database. How can I set the database to always print only the one
page?

 
Reply With Quote
 
 
 
 
Rick B
Guest
Posts: n/a
 
      22nd Mar 2007
You print reports, not tables, forms, or queries. If you want a record to
print, build a report and include a filter.

Personally, I create a report and add a button to my form. When I click the
button, it prints the report for whatever record I am viewing. I have used
this to print "employee worksheets" and "project tickets" etc.

Here is the code that would be tied to a button to print a report for the
current 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





--
Rick B



"Linda" <(E-Mail Removed)> wrote in message
news:774259D2-1C68-40A5-8F39-(E-Mail Removed)...
> when I go into my access database and want to print I have to always
> remember
> to click on selected record for it to print only that page or it will
> print
> the whole database. How can I set the database to always print only the
> one
> page?
>



 
Reply With Quote
 
=?Utf-8?B?U2NvdHQ=?=
Guest
Posts: n/a
 
      22nd Mar 2007
Boy am I glad I read this, it helped me get something fixed in one of my
databases. It was very thoughtful of you to include the differences for TEXT
Primary ID fields.

Thanks,
Scott


"Rick B" wrote:

> You print reports, not tables, forms, or queries. If you want a record to
> print, build a report and include a filter.
>
> Personally, I create a report and add a button to my form. When I click the
> button, it prints the report for whatever record I am viewing. I have used
> this to print "employee worksheets" and "project tickets" etc.
>
> Here is the code that would be tied to a button to print a report for the
> current 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
>
>
>
>
>
> --
> Rick B
>
>
>
> "Linda" <(E-Mail Removed)> wrote in message
> news:774259D2-1C68-40A5-8F39-(E-Mail Removed)...
> > when I go into my access database and want to print I have to always
> > remember
> > to click on selected record for it to print only that page or it will
> > print
> > the whole database. How can I set the database to always print only the
> > one
> > page?
> >

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing Access reports on another computer w/o Access Curtis Microsoft Access Reports 4 15th Dec 2009 02:12 PM
Printing stops after printing first report from Access 2002 =?Utf-8?B?TWFyayBD?= Microsoft Access 0 23rd Sep 2005 07:53 AM
Access 2000 reports not printing in Access 2003 =?Utf-8?B?SGVpbnogVGhvcndhbGQ=?= Microsoft Access Reports 5 9th Aug 2005 05:00 PM
Printing in Access =?Utf-8?B?RnJhbms=?= Microsoft Access Reports 0 19th Mar 2005 03:17 AM
Why do I get errors printing an Access 97 app. opened in Access 2. =?Utf-8?B?Sm9obg==?= Microsoft Access 0 30th Nov 2004 01:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:43 PM.