Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refreshing displayed list after a change 1

Status
Not open for further replies.
Jul 24, 2000
88
CA
Hi experts,

In Access XP, I show a list of 'candidates' that are the result of a query view of a table. The same form allows the user to add a new candidate to the view but when that is done, the list is not automatically refreshed to include the new candidate. Using the .Refresh only helps if I navigate off the newly added entry and then back which I do programmatically using DoCmd ... acNext then acPrevious. That approach works fine accept in the situation where the view is initially empty. In this case, when the DoCmd ... acNext is executed, an error occurs (because the record pointer is already pointing off the end of file). How can I programmatically determine that the current view is empty and thus, do something else? Does anyone have a better way of displaying the updated list?

Thanks in advance for any help you can bring.

Richard.
 
You may consider .Requery instead of .Refresh

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, you can see that I'm not up to speed with all of the Access command/function options. Requery sounds obvious now you mention it! I've been looking for a dictionary of commands/functions with all of the flavours but, as yet, have not been able to find one - either hard or soft copy!

Thanks again.
 
I've been looking for a dictionary of commands/functions
When in VBE (Alt+F11) feel free to play with the F2 (Object browser) and F1 (Help) keys.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I have just gotten around to trying the .Refresh and guess what - I was using that all the time and it doesn't work!

Here's what I am doing. I navigate to an empty (new) record in the recordset, choose a new entry from my combo box and would like to see that new entry reflected in a list of assigned entries in my list box. I have event triggers on the ...AfterUpdate, ...Change and ...LostFocus which do the .Requery. But the new entry does not show in my list box! Is this because Access has not yet 'inserted' the new record? If so, how can I 'encourage'/'force' the insert before I do the .Requery?

Thanks for any help you can give.

Richard
 
Ms.A will normally inset the new record when moving the focus off of the record. You van force the save, but you need to check that all required fields have values BEFORE this.



MichaelRed


 
Maybe try the BeforeInsert Event....
 
Hi, Richard,

To force the record to be saved:
Code:
DoCmd.RunCommand acCmdSaveRecord
HTH,

Ken S.
 
Thanks for this Ken! This particular DoCmd is not available when I am in 'debug' mode although it appears to work fine in non-debug mode. Is there an alternative way I can save the current record that is available in debug mode?

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top