>To be more precise I get the error message described to you n my previous reply, when the following code is attempted to be executed, since the Gri is not bound to the database through the data control
>
>>
> If PARTS.Recordset.EOF = False Then <===Error generated at this point!
> PARTS.Recordset.MoveNext
> If PARTS.Recordset.EOF = True Then
> PARTS.Recordset.MovePrevious
> End If
> End If
><
>
>Thank you
Simply put call the Refresh method after changing the DatabaseName property so your code will look like this:
Private Sub Form_activate()
With Data1
Data1.DatabaseName = "D:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb"
Data1.Refresh
If Data1.Recordset.EOF = False Then
Data1.Recordset.MoveNext
If Data1.Recordset.EOF = True Then
Data1.Recordset.MovePrevious
End If
End If
End With
End Sub
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com