?
Solved

ADODB Recordset Requery

Posted on 2006-11-06
6
Medium Priority
?
716 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: 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!

 

Author Comment

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

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

649 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