Error 3021 strange problem with .MoveFirst

J

Julia Boswell

Hi all

I've got a strange problem with a simple piece of code:

Dim db As ADODB.Connection
Dim rsQuery As New ADODB.Recordset
Set db = CurrentProject.Connection
Dim PN As String
Dim App As String
rsQuery.Open "LoopQuerywithPNsandApps", db, adOpenKeyset, adLockOptimistic,
adCmdTableDirect
rsQuery.MoveFirst
While Not rsQuery.EOF
PN = rsQuery!Query
PN = Left(PN, 12)
rsQuery.Fields("TopLevelPN").Value = PN
App = rsQuery!Query
App = Right(App, 5)
rsQuery.Fields("AppliqueSN").Value = App
rsQuery.Update
rsQuery.MoveNext
Wend

The code is falling over at the rsQuery.MoveFirst - I get error 3021 either
EOF or BOF is true or the current record has been deleted. None of those
statements are true, I've run the query and it works fine. It is populated
with 1227 records and the first record is fully complete.

Any ideas?

Thanks
Julia
 
J

Julia Boswell

Sorry folks, found the problem. The query had a wildcard search which works
fine when running it directly from Access but I needed to change the * to a
% for the purposes of ADO.

Julia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top