Printing an uncommitted record

  • Thread starter Thread starter Darrell
  • Start date Start date
D

Darrell

I have a problem which I repeatedly encounter. I need the user to be
able to print a report which is based on a record just entered, BUT NOT
YET COMMITTED. How do I commit the record when the user clicks "Print"?
It seems like it should be an absurdly simple problem to solve, but I
find myself struggling to do so. Is there no way besides elaborate code
blocks which capture the Bookmark (or a primary key), then requeries,
then returns to the record-of-origin? That seems like a lot of work
merely to commit a record before printing it. Am I missing something?

Thanks in advance for your help.

Darrell
 
It is so simple that you'll probably dent your forehead when you go duh!

A single line of code, placed prior to the OpenReport or OpenForm Method is
all it takes.

DoCmd.RunCommand acCmdSaveRecord
 
For years, to send the current reocrd to the printer, I build a reprot...

me.Refresh ' this commits the reocrd
docmd.OpenReport "rptCustomer",,,"id = " & me!report

So, you can use me.Refresh
 
Although Refresh and Requery will both save the current record, that isn't
their function. It is a side effect. For clarity and for the sake of
myself and others who might read the code in the future, I prefer to use the
instruction that saves the current record and doesn't do anything else.
When I want to refresh the form, I use .Refresh and when I want to requery
it, I use Requery and reposition the record pointer if necessary. People
post all the time about the unintended side effects of Requery especially.
 
Pat said:
It is so simple that you'll probably dent your forehead when you go duh!

A single line of code, placed prior to the OpenReport or OpenForm Method is
all it takes.

DoCmd.RunCommand acCmdSaveRecord
Thank you, thank you, thank you! I KNEW it couldn't be so complicated! I
didn't know the docmd method existed, and THAT is what I should probably
be denting my forehead for!

Thank you again!

Darrell
 
Back
Top