I've got a form that allows users to:
1) select a database using the openfile dialog
2) using the database path selected, use the JET_SCHEMA_USERROSTER, harvest the machinenames, logins, etc of all users currently logged into the database.
3) writes these names to a table called tblUsersOn
the code then requeries a subform that is driven directly by tblUsersOn and executes some code that works with the RecordCount of the recordset.
Problem:
1) the subform does not requery. In fact, after the delete query executes (to clear out the old information in preparation for the new records) the subform never shows the new records
2) the recordset doesn't see the records in the table. Even though there are 10 records in the table, the code errors on:
rst.MoveFirst, rst.RecordCount, or rst.MoveLast
3) when I run an append query or delete query from code, the warnings do not indicate that I am adding or deleting any records. If I perform the same operations without using code, they work fine.
4) Sometimes, if I step through the code, it works. Sometimes, it doesn't. About 8 times out of 10, it doesn't work.
Attached is a text file containing my code.
Any suggestions would be greatly appreciated,
Crystal
Originally posted by LynchurianBlue I've got a strange problem here...
...Sometimes, if I step through the code, it works. Sometimes, it doesn't. About 8 times out of 10, it doesn't work.
How old is the database? No, not the version - the file? How long has it been under development? Old versions of the code can hang arround within the file. Compact and repaire does not always clean it up. Sometimes msaccess.exe /uncompile mybd.mdb from the command line and then C+R is supposed to be better for getting rid of unexplainable problems.
Also you can try creating a new DB and importing EVERYTHING from the old one. Strangly it should be fast and more efficient.
2) This may depend on the type of recordest you use. You may want to try closing your recordset and re-opening it. Btw, is your form bound to the table?
3) You do not get the warnings for action queries if you are using the .Execute method.