?
Solved

Access 2003, Refresh Form Data

Posted on 2009-02-17
6
Medium Priority
?
759 Views
Last Modified: 2013-11-28
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_RefreshDisputesTbl_Click:
    Exit Sub
 
Err_RefreshDisputesTbl_Click:
    MsgBox Err.Description
    Resume Exit_RefreshDisputesTbl_Click
    
End Sub

Open in new window

0
Comment
Question by:ggodwin
  • 3
  • 2
6 Comments
 
LVL 28

Accepted Solution

by:
TextReport earned 500 total points
ID: 23661871
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
0
 
LVL 85
ID: 23662098
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.
0
 

Author Comment

by:ggodwin
ID: 23662256
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?
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
LVL 28

Expert Comment

by:TextReport
ID: 23662279
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
0
 

Author Comment

by:ggodwin
ID: 23662363
Can I not use it in the same event that triggers the update to the table? Just after the import if complete?
0
 

Author Comment

by:ggodwin
ID: 23662389
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"
Me.Requery
DoCmd.SetWarnings True
End Sub

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

850 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