View Single Post
  #1 (permalink)  
Old November 9th, 2006, 11:28 AM
stealthdevil stealthdevil is offline
Friend of Wrox
 
Join Date: May 2006
Location: Jonesboro, AR, USA.
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Default inconsistent data

Hi,
I'm having a problem with a module giving inconsistent data. It reads from the same sources every time I run it, but the data is not always the same.
I have a couple of queries that run back to back inside the module. I think that one might be starting before the other finishes. There's also a loop that acts kind of strange(I think).
Code:
'Loop back through records to assign a sort order
Set rstflip = mydb.OpenRecordset("tbl_os_seq", DB_OPEN_TABLE)
rstflip.MoveFirst
While Not rstflip.EOF
    row_cnt = row_cnt + 1
    rstflip.Edit
    rstflip![SORT KEY] = row_cnt
    rstflip.Update
    rstflip.MoveNext
Wend
When I step through this code I notice that when the first row is assigned a sort key it is then sent to the bottom of the table. The second row is then assigned a sort key and sent to the bottom of the table(below the first sort key). This continues thoughout the whole loop, so the first key does end up back at the top. This seems kind of odd to me. Is it normal for it to work this way?

Any thoughts? suggestions?

Thanks,
Dave

Reply With Quote