Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO to an Access database

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
here is my code. I am getting Error:
Run time Error '3021':
Either BOF or EOF is true or the curent record has been deleted.

================================
Dim Conn3 As ADODB.Connection, rst3 As ADODB.Recordset, SQLcode3, strSQL As String
Set Conn3 = New ADODB.Connection

Set rst3 = New ADODB.Recordset
Conn3.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\smallbserver\AppsSBS\Encore\FilePaths.mdb"
SQLcode3 = "SELECT * FROM [Drawing-Paths] WHERE Drawing Like '" & Extension & "*';"
rst3.Open SQLcode3, Conn3, adOpenStatic, adLockOptimistic

'Instantiate a Recordset object.
Set rst3 = New ADODB.Recordset

'Open a recordset using the Open method
'and use the connection established by the Connection object.
strSQL = "SELECT * FROM [Drawing-Paths] WHERE Drawing Like '" & Extension & "*';"
rst3.Open strSQL, Conn3, , , adCmdText
rst3.MoveFirst
Debug.Print rst3!Path
=============================
I just need to return one record from the database.

TIA

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
MTL, the 1 row you are anticipating to be returned, isnt. Hence, you have an empty recordset.

rst3.Open strSQL, Conn3, , , adCmdText
If rst3.EOF and rst3.BOF Then
MsgBox "You've got an empty recordset"
Else
rst3.MoveFirst
Debug.Print rst3!Path
End If Jon Hawkins
 
Thanks for the info. the problem was actually something else and it keep stopping there.
The record is in the database, and even if I changed the SQL statement to "Select * From Tablename" I got the same error.

Thanks again though DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Doug

Why do you reset your RST3 recordset after having spent
all the time to add data to that recordset in the first part
and then reset it to a new recordset just to fill it again.
should you use two different recordsets?
Morgan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top