Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access 2007 Display newly added record in continuous form

    Mainform contains textbox for new record.
    Afterupdate event adds the record to database. (INSERT INTO table...)
    and requeries a subform to show the added record.

    The subform, based on a query, contains the added record.
    I expected the requery to reposition the subform to the first record
    but it does not.
    Furthermore, I need the newly added record to be displayed and selected.
    I am probably confused on the relationship between main and subforms and recordsets from queries.
    Any advice is much appreciated.

  2. #2
    Star Lounger
    Join Date
    Jan 2010
    Location
    Oregon
    Posts
    61
    Thanks
    9
    Thanked 0 Times in 0 Posts
    I'm not clear on some of the details, like how you're displaying your subform (datasheet view, continuous form, etc.), but perhaps this will help.

    Regarding the subform displaying the newly added record, try this in your AfterUpdate event:

    Me.<MySubformName>.SetFocus
    DoCmd.RunCommand acCmdRecordsGoToLast

    or

    Me.<MySubformName>.SetFocus
    DoCmd.GoToRecord , , acLast

    Once done, the record should be displayed and selected.

  3. #3
    New Lounger
    Join Date
    May 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Reid for your response. When I implemented your suggestion I find a new record is indeed added to both the table and continuous form. However that continuous subform is left with the focus on the last record in the form, not the newly added one, and displays it at the visible top of the form as the only record showing. If you have another suggestion I'd be most appreciative. I've been trying to use 'findfirst' but so far without success. Maybe incorporating it with your setfocus will do the trick. I'll try that. You may have some advice about that!

    Tried it - got NoMatch! Maybe checks before record finished adding... I'll keep experimenting.
    Last edited by rttrent; 2013-05-11 at 01:28.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •