08-15-06, 21:50 #1Registered User
- Join Date
- Feb 2002
Unanswered: Corrupt Database after sorting a subform
I have been having a problem for a while and finally found that it has to do with subform sorting. Using Access XP with FE/BE and approx 100 forms and 40 tables, I have found that occasionally I add a control that will change the sort order of the subform and then the database will consistently crash (Windows has encountered and error and must close.....blah blah blah) then it asks if you want to rebuild the database (does not help).
The only solution is to go back to a back up. I have tried removing all of the code for the master form and the subform and reimporting from the backup but it does not help, still get the error.
Anyone have any ideas what may cause this. I find no problem with the code, I have exported the code and compared it line by line with the backup and they match perfectly, down to every space. One other thing will work is to delete the bad subform and import from the backup, program will run as normal.
It's almost like the subform is sorted one way (like it was when I resorted and closed it) and the master form expects it a different way and it crashes. If you delete the subform, the form will work normal, so that indicates the master is not trying to resort, right ??
I'm lost. I have started working around, by simply changing the recordsource of the subform in the code, but in some cases I need the other way.
08-16-06, 03:45 #2Registered User
- Join Date
- Feb 2004
Does this happen only when you add this specific control, with the specific code? (I.E. you can add other controls without any problems?)
If so what's the code you are using?
Have you compiled the entire database and fixed/removed all dodgy/strayed code?
Have you tried creating a blank database, and importing all the objects from your database into it? (You could initially only import the troublesome subform and it's related objects, to test)
08-16-06, 08:58 #3Moderator
- Join Date
- Dec 2004
- Madison, WI
Have you looked at indexing? This does kind of sound like an indexing problem. Could there also be a rogue field value in one of the fields (i.e. a date field which somehow got populated as 12/04).
Last edited by pkstormy; 08-16-06 at 09:03.Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)