?
Solved

Error repopulating MSHFlexGrid

Posted on 2002-07-30
7
Medium Priority
?
480 Views
Last Modified: 2008-02-20
I have a form to allow users to select historical data from a table by any of several criteria using combo boxes. The grid loads fine at Form load, but when the selections are made, and I try to load it again with the recordset from the selection statement, I get the following error:

Run-time error '30023':
Unable to access data. DataSource settings may be incorrect, or the DataSource functionality may be limited.

I have tried declaring this recordset locally, and in the General section.  I am clearing the grid, before opening the recordset and before setting the DataSource value to the recordset.  I have verified that, when I reach the statement assigning the DataSource for the grid, that my sql SELECT statement is correct, that my recordset is open, and has the selected data.  

0
Comment
Question by:isrspgmr
7 Comments
 
LVL 1

Expert Comment

by:knuckle05
ID: 7188824
Have you tried putting a data control on your form and connecting your grid to the data control? Then you could try refreshing the data control.

I'm not even sure if this is possible. Just an idea...
0
 

Author Comment

by:isrspgmr
ID: 7188855
Thank you for the suggestion.  Actually though, we have a company policy against using data controls. We try to stick to ADO objects.
0
 
LVL 1

Expert Comment

by:knuckle05
ID: 7188898
From what I've seen by looking around, it seems a lot of people have had this problem.

Try setting

MSHFlexGrid1.DataSource = Nothing

before you reset it.
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:isrspgmr
ID: 7189045
Yes, thanks again, but I had actually seen that suggestion in previously asked questions before I posted this one.  I have tried that, before setting the datasource, I've tried it earlier on, before opening the recordset.  No difference.  In debugging the code though, even without trying to assign Nothing as the datasource, I can see that that is the value of the datasource property right before I execute the datasource assignment line that causes the error.
0
 
LVL 2

Accepted Solution

by:
mmcmillen earned 400 total points
ID: 7190487
I have seen a situation where checking the recordset for eof prior to the set grd.datasource = recordset caused problems.  

I did try this at home last night on my system and I had no problem. Here at work, I have the same problem.


0
 

Author Comment

by:isrspgmr
ID: 7190567
Excellent.  I was in fact testing for .EOF before the datasource assignment.  I have now tried closing the recordset after the .EOF test, and then reopening the recordset, and that has eliminated the error.  Thanks for the help.
0
 

Expert Comment

by:gotorx7
ID: 7359130
This fix worked for me also.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

850 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