Access VBADiscuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
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).
'Loop back through records to assign a sort order
Set rstflip = mydb.OpenRecordset("tbl_os_seq", DB_OPEN_TABLE)
While Not rstflip.EOF
row_cnt = row_cnt + 1
rstflip![SORT KEY] = row_cnt
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?
I think my problem may lie in this append query.
The first query deletes all records from the reverse table. Then the second query copies all the records from the sequence tbl(that the module just created) into the reverse table. When this query runs it acts like it doesn't get all the way through the records. It should start with the last record from sequence table, but it doesn't always and I don't know why. There are 653 records in the table.
DoCmd.RunSQL ("delete * from tbl_os_reverse")