Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

MS Access How can I refresh a form in datasheet view?

Posted on 2013-01-30
3
1,770 Views
Last Modified: 2013-01-30
I have two forms - one in datasheet view and one in regular form view with details.

I created a button to add a new record using the form with details.

Problem: After closing the detail form the datasheet form is not refreshed and doesn't display my new record.  How can I avoid a manual refresh of the datasheet?
0
Comment
Question by:DJPr0
3 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 38835733
You just do this in the form_close event procedure of the regular form.

Forms!Datasheetformname.Requery
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 total points
ID: 38835738
You cannot simply refresh the datasheet, as the refresh method will only reflect changes in the current recordset, not additions.

You will need to use the Requery method.  How are you closing the details form?  I would generally do something like:

1.  Have a Save/Close button which is used to write the current record and close the details form.
2.  In the Click event of that button, after saving the record, I would record the primary key associated with that record.

      lngAddedRecordID = ??

3.  Then I would requery the other form

Forms!OtherFormName.Requery

4.  Then I would use the FindFirst method to set the record pointer to the record that was just added, something like:

    With Forms!OtherFormName.RecordsetClone
        .FindFirst "[PKField] = " & lngAddedRecordID
        if not .nomatch Then
            Forms!OtherFormName.Bookmark = .Bookmark
        endif
    end with
0
 

Author Closing Comment

by:DJPr0
ID: 38836378
Thanks fyed
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question