ODBC read/write

Hi a have problem with reading/writing ODBC files. It seems that there is no problem with the connection but the agent that holds the following codes reads only 4 records from the end of the ODBC file, although it supposed to read hundreds. I deleted the last 10 records from the ODBC file to see if there is something wrong with the data but the result was the same: only the last 4 records was read again.

The agent is something like this:

table=“SALES”

qry.SQL = "SELECT * FROM " & table

result.execute

Result.CacheLimit=DB_NONE

If result.IsResultSetAvailable Then

dbffields=con.ListFields(table)

i=0

If result.GetValue(“NOTES”)=“” Then

Do

  i=i+1

  Set doc=db.createdocument

  doc.form="JelF"

  ...

  Call doc.Save(True, False)

  Call result.setValue("NOTES", "1")

  result.UpdateRow

  result.NextRow

Loop Until result.IsEndOfData

Msgbox "Reading from BOF is finished."

Exit Sub

Elseif result.GetValue(“NOTES”)=“1” Then

result.LastRow

Do

  i=i+1

  Set doc=db.createdocument

  doc.form="JelF"

  ...

  Call doc.Save(True, False)

  Call result.setValue("NOTES", "1")

  result.UpdateRow			

  result.PrevRow

Loop Until result.GetValue("NOTES")="1"

End If

Msgbox Str(i)+" records read."

result.Close(DB_CLOSE)

con.Disconnect

Thank you for your help.

Etyien

Subject: ODBC read/write

I read through it some. The big IF statement around the two loops seems to assume that all or none have Notes. As the second loop is moving PREV through the records, it appears that it finds one without a Notes value so it stops. Maybe I read it too quickly, but that is what struck me.

Subject: RE: ODBC read/write

Hi Doug,

Yes you are right, the end statement is missing from the codes in my topic, but it is in the code in the agent.

I deleted the “Result.CacheLimit=DB_NONE” line and it seems it’s now working fine.

Thank you.

Etyien