Solved

ADODB Recordset Requery

Posted on 2006-11-06
6
672 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
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…
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.

911 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

15 Experts available now in Live!

Get 1:1 Help Now