I need to Requery and Stay On the Same Record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subform that users use to enter in data. After they enter in the
data they then click on a button to print the record that asks them for their
ID (which is an autonumber and shown on the form) because there are multiple
records per user. My problem is that if a user enters new data then hits the
"print" button I have made, which is set up to requery and then print, it
takes them back to their first record and their correct ID to print their
data does not show up. So basically, I need to stay on the same record when I
hit "print" so that users can see their ID number. I know there have been
posts about this before but I had a little trouble understanding the code as
I am a new user to Access. Any help you have in the simplest form would be
greatly appreciated. Thanks in advance.
-Nick
 
Why are you requerying? Are you doing that to force the data to be saved?

If that is the reason, then instead of the requery, you should be able to
use one of the following lines of code to save the record.

IF Me.Dirty = True then Me.Dirty = False

Or

Docmd.RunCommand acCmdSaveRecord

And then you can run the rest of your code. You probably could print the
current record using some code that gets the Id from the current record
without user intervention.



--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Yes I was just trying to save, thanks for your help it helped me get
everything figured out. Thanks again
 

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