We help IT Professionals succeed at work.

DataGrid "The current row is not available.:

JoeNeary asked
I have a form with a datagrid and recordselectors that allows users to browse but not change or add the records in a lookup table.  I set the datagrid's datasource property to a recordset object. DataGrid1.DataSource = rst.  The recordset is ADO "Select fields from, etc."
No adodc control used.

Everything work fine except if I open the form and then immediately close it by clicking the close "x" button, I get a message titled "Microsoft Data Grid", message "The current row is not available."  The form close without problem, however.

If I click on any recordselector, change record, do anything, the form closes without the message.

What do I need to do to prevent the message from displaying?

Watch Question

You could try:

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Unload DataGrid1
End Sub
Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer

Hi JoeNeary,

Set DataGrid1.DataSource = Nothing when exit?
Author of the Year 2009

Hi JoeNeary@devx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept SirNick's comment(s) as an answer.

JoeNeary@devx, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer
Per recommendation, force-accepted.

CS Moderator