Print the last record

  • Thread starter Thread starter Ian Tranter
  • Start date Start date
I

Ian Tranter

I have a report bound to a tabe "SCRAP data" & want to
print the very lastr record entered? HOW di I do this???

Currently the report prints every record.

Also, when I have entered data into the table from a
form, I would like to print that record fron the report
above. Can this be done? I thaught of placing a command
on a button???
 
Assuming the table has a primary key (autonumber) named "ID", and you have a
command button to print the current record, set its On Click property to:
[Event Procedure]
Click the Build button (...) beside this.
Access opens the code window.
Your procedure should look something like this:

Private Sub cmdPrintRecord_Click()
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check we have a record to print
MsgBox "Select a record to print."
Else
DoCmd.OpenReport "MyReport", acViewPreview, , "ID = " & Me.[ID]
End If
End Sub
 
Back
Top