Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    billgyrotech is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    45

    Remain on Current Record

    I would like my form to show current record after selecting command button to print preview current record on a report. I am not sure how to do this.
    Can someone please help?

    Thanks in advance,


    billgyrotech

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    probably not enough info to answer your post. a command button that would open a report in print preview does not inherently affect the record selected of a form - it might if one adds some vba in that button event - however that isn't clear.

    if what you mean is that you are looking at a record in a form - and then you want the report to open to this same record - - then in this case the key to resolving your issue is that the report's record source must correspond to the value of the record in the form; probably via a query as the record source that has a criteria using a value from the form.

    Hope this helps.

  3. #3
    billgyrotech is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    45
    My button previews the current record on a report but when I close the preview, my form displays the first record and not the current record.

  4. #4
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Sounds like the form is being requeried for some reason. Is there any code for requerying either in the code that opens the report or in the report's close event?

  5. #5
    billgyrotech is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    45
    I am not sure.

  6. #6
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Are you using VBA or macros? Take a look at whatever you are using to open the report and see if anything says REQUERY. If so, then that is what you are looking for. If you are running a macro or have VBA code in the report's ON CLOSE event, then look there as well.

    If you still aren't sure, run Compact and Repair, zip the file by right-clicking on it and selecting SEND TO > COMPRESSED FOLDER and then upload a copy of it here. Make sure you don't include any sensitive data, but use bogus data instead so we can take a look.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Opening and closing a report shouldn't affect the record the form is on. If you're requerying, perhaps this:

    http://www.baldyweb.com/Requery.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sorry, had this open for a while after the boss came up to talk to me.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by pbaldy View Post
    Sorry, had this open for a while after the boss came up to talk to me.
    No worries.

  10. #10
    billgyrotech is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    45
    Where can I attach the file?

  11. #11
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by billgyrotech View Post
    Where can I attach the file?
    The instructions for doing it here are the same as over on this other site:
    http://www.access-programmers.co.uk/...d.php?t=140587

  12. #12
    billgyrotech is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    45

    Remain on current record

    I have attached the zip file. When opening, select Workorder button and then on that form there are 3 Preview buttons for reports. Whenever I select a button the form reverts back to the first record. I don't know why this happens but is there a way to remain on the current record?
    Last edited by billgyrotech; 08-09-2011 at 03:13 PM.

  13. #13
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Yep, you have this:

    Me.Requery

    in the form's On Activate event. That is what is causing your problem.

  14. #14
    billgyrotech is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    45
    How to correct this?

  15. #15
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by billgyrotech View Post
    How to correct this?
    Go to the form's On Activate event and remove the Me.Requery.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. No current record.
    By harmankardon in forum Programming
    Replies: 5
    Last Post: 08-11-2011, 05:48 AM
  2. Report from current record
    By billgyrotech in forum Reports
    Replies: 18
    Last Post: 07-26-2011, 03:39 PM
  3. Current record number
    By turvoll in forum Programming
    Replies: 1
    Last Post: 11-04-2010, 10:09 AM
  4. copy current record to new record
    By er_manojbisht in forum Forms
    Replies: 1
    Last Post: 02-27-2010, 05:31 PM
  5. Mailmerge Current Record...
    By oakleyp2 in forum Programming
    Replies: 0
    Last Post: 02-22-2006, 08:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums