ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Ado / Adox ? (https://www.excelbanter.com/excel-programming/315923-ado-adox.html)

silvest[_17_]

Ado / Adox ?
 

Hi, i'm not too familiar with VBA in Excel, but i'll try my best.

I'm trying to run a macro that'll generate numbers and fit it into
Access DB (which i've created using another macro)

the loop seems to be running fine, but an error occurs saying: "Either
BOF or EOF is TRUE, or the current record has been deleted. Requested
operation requires a current record."
and points towards this line: "

-- Recordset1.Update <--
Recordset1.Close
Set Recordset1 = Nothing


--
silvest
------------------------------------------------------------------------
silvest's Profile: http://www.excelforum.com/member.php...o&userid=14662
View this thread: http://www.excelforum.com/showthread...hreadid=275742


Myrna Larson

Ado / Adox ?
 
Can you post the rest of your code, specifically the line(s) that open the
recordset?

On Fri, 5 Nov 2004 13:41:14 -0600, silvest
wrote:


Hi, i'm not too familiar with VBA in Excel, but i'll try my best.

I'm trying to run a macro that'll generate numbers and fit it into
Access DB (which i've created using another macro)

the loop seems to be running fine, but an error occurs saying: "Either
BOF or EOF is TRUE, or the current record has been deleted. Requested
operation requires a current record."
and points towards this line: "

-- Recordset1.Update <--
Recordset1.Close
Set Recordset1 = Nothing



K Dales[_2_]

Ado / Adox ?
 
Either you do not have a new record created when you are trying the update,
or else Access is locking it from you, preventing the update.

Did you remember to call the AddNew method of the recordset? If not, you
have not yet created the space for the new record, so when you try to update
you run into the EOF. This would give the error message you are seeing.

If this is the case, make sure your code does the following after opening
the recordset:
Recordset1.AddNew 'optional: add field list and value list here, or:
' you will need code here to initialize all the fields in the new record
Recordset1.Update
....

A couple other things:
- Be sure to Update before any MoveNext, otherwise you will move past the
end of the file.
- Make sure your recordset's LockType allows updating and is not allowing
Access to lock the record or table on you, preventing any updates. I suggest
using adLockPessimistic to ensure you have full possession of that record
until you actually update it.

For all you ever wanted to know about ADO
http://msdn.microsoft.com/library/de...dooverview.asp

HTH - K Dales

"silvest" wrote:


Hi, i'm not too familiar with VBA in Excel, but i'll try my best.

I'm trying to run a macro that'll generate numbers and fit it into
Access DB (which i've created using another macro)

the loop seems to be running fine, but an error occurs saying: "Either
BOF or EOF is TRUE, or the current record has been deleted. Requested
operation requires a current record."
and points towards this line: "

-- Recordset1.Update <--
Recordset1.Close
Set Recordset1 = Nothing


--
silvest
------------------------------------------------------------------------
silvest's Profile: http://www.excelforum.com/member.php...o&userid=14662
View this thread: http://www.excelforum.com/showthread...hreadid=275742




All times are GMT +1. The time now is 08:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com