Solved

ADODB Recordset Requery

Posted on 2006-11-06
6
660 Views
Last Modified: 2012-05-05
I have a couple of list boxes, ex. lstActiveUsers that are based on an adodb recordset. When you double click an item in the list, it loads up a form where you can edit the details of the contents in the list. I want to have the list update when the updatable form is closed, since while editing the details of the list, you could change the user to inactive and therefore shouldn't be in the form anymore.
0
Comment
Question by:BrucePowerOPs
6 Comments
 
LVL 39

Expert Comment

by:stevbe
ID: 17881027
make the reordset variable be public and in the Close event of the update form call prstActiveUsers.Requery.

you could refine it and track in the updatebale form to see if anythign has been added/deleted, if not then a refresh should do the trick and be faster.

Steve
0
 

Author Comment

by:BrucePowerOPs
ID: 17881183
That doesn't work. It gives me an error: Operation not allowed when the object is closed. I think it's because I have the settings:

rst.CursorType = adOpenStatic
rst.LockType = adLockReadOnly
rst.CursorLocation = adUseClient
Set rst.ActiveConnection = Nothing

Any other ideas?

I guess I I could just set the recordset again to a recordset with the same sql statement...
0
 
LVL 11

Expert Comment

by:fanopoe
ID: 17881262
try these settings:
rst.CursorType = adOpenDynamic
rst.LockType = adLockOptimistic
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:BrucePowerOPs
ID: 17881274
That might work however I don't want those settings.
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
ID: 17881306
You're closing the connection for the recorset, therefore you cannot refresh or requery. YOu would have to reset the connection, then requery:

Set rst.ActiveConnection = <some connection object>

then requery
0
 

Author Comment

by:BrucePowerOPs
ID: 17881321
Ya that's what I had thought. I guess I'll just reset the connection upon returning to the form.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now