Print last entered record in a form

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

I would like to create a command button to print the last entered record
from a data entry form. I am having a bit of trouble with the code logic.
Any help would be greatly appreciated.

Thanks,

Nick
 
Nick,

This really depends a lot on where the command button is going to be
positioned. In any case, it will be governed by the criteria in the
query that your report is based on. If the button is on the detail
section of the form, all you need to do is refer to the unique
identifier field on the form in the criteria of this field in your
query, using syntax the equivalent of...
[Forms]![NameOfForm]![NameOfIDfield]
Otherwise, you will of course need a field in your table that
identifies the order in which the records are entered, either an
Autonumber or other incrementing value, or DateTimeEntered field. You
didn't mention what this was, so for now I will assume it is called
YourCounter. Then, in the YourCounter field in the report's query,
put...
In(SELECT Max([YourCounter]) FROM NameOfYourTable)

- Steve Schapel, Microsoft Access MVP
 
Thanks for your help!

Nick

Steve Schapel said:
Nick,

This really depends a lot on where the command button is going to be
positioned. In any case, it will be governed by the criteria in the
query that your report is based on. If the button is on the detail
section of the form, all you need to do is refer to the unique
identifier field on the form in the criteria of this field in your
query, using syntax the equivalent of...
[Forms]![NameOfForm]![NameOfIDfield]
Otherwise, you will of course need a field in your table that
identifies the order in which the records are entered, either an
Autonumber or other incrementing value, or DateTimeEntered field. You
didn't mention what this was, so for now I will assume it is called
YourCounter. Then, in the YourCounter field in the report's query,
put...
In(SELECT Max([YourCounter]) FROM NameOfYourTable)

- Steve Schapel, Microsoft Access MVP


I would like to create a command button to print the last entered record
from a data entry form. I am having a bit of trouble with the code logic.
Any help would be greatly appreciated.

Thanks,

Nick
 

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

Back
Top