Creating a report

N

Nick T

Hi,

I have a table, for which contains many records. I am using a form to
navigate through the information within the table.
I want to create a command button which when clicked, prints out the last
record in the table.

However, because of the print format/layout i need, i feel it is best for me
to create a report & the command button simply prints the report. Therefore
i need to create a report which displays only the last record in my table.
How do i do this??
Any suggestions???

Many thanks
 
S

Stockwell43

Here's another one:
(Q) I'm trying to print out only the current record from my form in a report
but each time all the records print out. How can I print only one record
using a report?

(A) Use the OpenReport's Where condition to specify your record. For
example, the following code placed behind a command button on the form would
use the RunID control on the form to restrict the Report to only one record.

'******************** Code Start ************************
Dim strDocName As String
Dim strWhere As String
strDocName = "rptSomeReport"
strWhere = "[RunID]=" & me!RunID
DoCmd.OpenReport strDocName, acPreview, , strWhere
'******************** Code End ************************

Here is the link, good wbesite:
http://www.mvps.org/access/reports/rpt0002.htm
 
B

boblarson

How are you determining the "last" record in your table? Records are not
stored in any particular order (although at times it may LOOK that way).
So, you need to provide a sorting mechanism, and that would typically be
best by having a date/time stamp (because an autonumber is not guaranteed to
be sequential, just unique).


--

Bob Larson
Access MVP
Access World Forums Administrator
Utter Access VIP
Free Access Resources at http://www.btabdevelopment.com
 
N

Nick T

Hi,
Perhaps my explanation isnt too great.
So,
the user opens a form and adds a record to my table using various command
buttons i have on the form. Once the information is completed, i want the
user to be able to print this record by simply clicking a command button.
Anyway, i have this working ok, however i need to change the layout of the
print out - its currently just printing the form in its 'on screen' view.
so, i think i need to create a report to do this, however for my report to
pick out just the 'last' record (the record just added), i think i may need
to create a query and use some SQL code.(?) then once i have the query
picking out the 'last' record, i can link the report to the query........i
think!

Any suggestions??
Thanks
 

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