Solved

ADODB Recordset Requery

Posted on 2006-11-06
6
701 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

724 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