Either BOF OR EOF is True Error

S

subbu

Hi,
I am using the do while loop to sum up the values for a
particular month.This i have to do for 12 months.Here is
my code

ssql = "SELECT * FROM UsageHistory"
Set rsUsageHistory = conn.Execute(ssql)
Set rsAmount = conn.Execute(ssql)
Dim ii As Integer
Do While Not rsAmount.EOF
strdt = rsAmount("RDG_DAT").Value
Do While (strdt = rsAmount("RDG_DAT").Value)
strAmount = strAmount + rsAmount
("AMT").Value

If Not rsAmount.BOF And Not rsAmount.EOF Then
rsAmount.MoveNext
End If
Loop

InvAmount(ii) = CStr(strAmount)
strAmount = 0#
If Not rsAmount.BOF And Not rsAmount.EOF Then
rsAmount.MoveNext
End If
Loop
Any error in the code??

regds
subbu
 
M

[MVP] S. Clark

**Although the name of this newsgroup is 'Queries',
it is actually referring to the Access Database Query Object.**

For future coding questions, please visit m.p.a.modulesdaovba.ado

Change the Do While to

Do While Not rsAmount.EOF AND not rsAmount.BOF

and remove the If..then that checks for it.

--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 

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