Access 2003, Refresh Form Data

I have an append query that inserts data into a table. This table is being viewed through a form. However, I can not see the newly imported data in the form until I close the form and re-open.
I have added a "refresh" button below to refresh the data. However, it is not working?

Table: Dispute
Form: fDispute

Any idea?
Private Sub RefreshDisputesTbl_Click()
On Error GoTo Err_RefreshDisputesTbl_Click
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
    Exit Sub
    MsgBox Err.Description
    Resume Exit_RefreshDisputesTbl_Click
End Sub

Open in new window

Who is Participating?
TextReportConnect With a Mentor Commented:
You need to do a me.requery after tour DoCmd line. (I don't think a me.refresh will return the new records.)
Cheers, Andrew
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
To expand on what Andrew said:

Refresh merely refreshes the current recordset. Therefore, new records would NOT be included in that. If you delete records from that current recordset (or someone else does), those deletes would be included.

Requery rebuilds the entire recordset, and would include new records by you or other users, as well as deletes and edits.

You really only need to do a Requery; there's no need to Refresh and Requery.
ggodwinAuthor Commented:
Yes, that worked fine.
Let me ask an additional question.
I have the below code to populate the table.

Is there a way I can add something in here so that it will always "me.requery" before the user every see's that the data is not there?
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

You have to trigger it on an event, currently you are using the OnClick event of the button, you could use the OnTimer or the AfterUpdate events but they tend to get messy with your users interaction, often best to keep it simple like you have the command button.
Cheers, Andrew
ggodwinAuthor Commented:
Can I not use it in the same event that triggers the update to the table? Just after the import if complete?
ggodwinAuthor Commented:
yep it appears to work? I added it and it works fine. Is there anything can go wrong down the line?
Private Sub ImportDisputes_Click()
DoCmd.SetWarnings False
DoCmd.RunSQL "delete * from tempDisputes"
DoCmd.OpenQuery "qNeedDispute"
DoCmd.OpenQuery "UpdateDisputetbl"
DoCmd.SetWarnings True
End Sub

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.