Strange behaviour - hands free switched between vba window and access window lost vba (1 Viewer)

sxschech

Registered User.
Local time
Today, 03:44
Joined
Mar 2, 2010
Messages
791
I was reviewing some code in a vba standard module (not related to the open form) and all of a sudden it switched back to the form (which was in normal view). My hands were no where near the keyboard or mouse. I noticed the form flicker (no flicker prior to the switch). To my knowledge, I don't have a timer event. I do have a current event that hides/unhides text and changes some captions. I did a compact and repair (which I do at least once a day anyway) and when I opened up the accdb, all the code was gone. I copied a file from yesterday and when I opened I noticed a message at the bottom saying it was repairing and this too "lost" the code. I then created a new db from scratch and imported all the objects except for the vba and there was new table I hadn't seen before titled "MSysCompactError" and I opened it up and this was inside:
ErrorCode ErrorDescription ErrorRecid ErrorTable
-1206 Could not find field 'Description'. MSysObjects
In the new db I have manually added in the vba code (copy/paste from a text file). Since the code behind form seems to still be there, I left it as is.
Anyone experience something like this? Could it be because I was using it on a network drive? This time, I have created the new db on my hd, but will still need to eventually link to data on the network.

It's a very small db (1,448kb) that I'm just starting to build. The only change since I closed the file yesterday and opened it today was to delete a record in a table (directly in the table not the form) and I decided to create a new module and move some code into the new module. The second time, I copied the backup and didn't do anything to the file. Hopefully creating a new db and importing the tables, queries and forms and manually pasting in the vba modules will solve the issue as I would be most disappointed if I can no longer use the work I've already done.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:44
Joined
Feb 28, 2001
Messages
27,001
First, this is CLEARLY a sign of major corruption. Make a copy of that DB immediately and NEVER AGAIN work on the copy. Instead, do your best to create a new database and import all of the parts you can from what is left - but don't hold your breath about recovering everything.

Second, I hope you had a copy of the DB already backed up because a DB that has lost the "Description" field from MSysObjects is on its last legs. That is a CRUCIAL situation. Oh, the DB would probably run without that field - well, remotely possible anyway - but the real issue is that MSysObjects was affected, and that is a crucial table that is irreplaceable. If that table goes kablooie on you, you have NO database. NOTHING. ZILCH. And it will be unrecoverable in whole, not just in part.

This is also a sign from the great code gods that you need to start making regular backups anytime you make major changes in anything. A whole-file backup copy is easy enough and will automatically be date tagged. However, there is also the idea that from a code window, you can export modules to text files just in case you lost something. How you do it is actually immaterial. It is THAT you do it that makes backups valuable.
 

sxschech

Registered User.
Local time
Today, 03:44
Joined
Mar 2, 2010
Messages
791
Thanks for the information. I do backup the files I work on daily before I open them. Since this happened first thing, not much, if anything was lost, I was able to extract out the vba code into an another new blank db and then copied and pasted from that rather than importing directly. Regarding the msysobject table, I thought this was normally hidden from the user, so I was surprised that it showed up when I imported the tables (but turns out a good thing it showed up to indicate something was seriously wrong). As mentioned in my original post, I did import the objects except for the vba modules into a completely new db. The vba code that were part of the forms came in when I imported the form objects. Should I have not imported form vba? Anyway, at least for now, the new db is running smoothly. I still notice an occasional flicker on the access form while I am doing something else (such as typing this in a web browser while the access window is partly visible). Hope that isn't a bad omen for my shiny new (albeit imported) db.
 

isladogs

MVP / VIP
Local time
Today, 10:44
Joined
Jan 14, 2017
Messages
18,186
All hidden and system tables will be visible in an external database if you tick those options in your current database.

However when importing objects from another database, you should NEVER import any of the system tables apart from the two MSysIMEX tables if they exist.

In particular do not import MSysObjects as you do not want to transfer any errors to the new db. Access will automatically build the contents in the new MSysObjects table.

Two other things
1. Decompiling is worth trying before creating a shiny new version of your old db. It will often fix all errors and is very fast. For more info, see http://www.fmsinc.com/microsoftaccess/Performance/Decompile.asp

2. I wrote a thread in the code repository explaining ways of fixing certain types of error in MSysObjects. For further details see https://www.access-programmers.co.uk/forums/showthread.php?t=293579
 
Last edited:

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:44
Joined
Aug 30, 2003
Messages
36,118
Could it be because I was using it on a network drive? This time, I have created the new db on my hd, but will still need to eventually link to data on the network.

I don't see that anybody addressed this. My understanding is that running the app over the network can lead to corruption. You can certainly link to data across the network, but the front end should exist on each user's computer. That way you're only sending data over the network, not objects.

I develop in two locations. In both, the master accdb files are on my computer. In one, that computer is included in the network backup software so it's backed up nightly. In the other, my computer is a VM that is mirrored, and I also push the accdb files to a network folder that gets backed up weekly.
 

sxschech

Registered User.
Local time
Today, 03:44
Joined
Mar 2, 2010
Messages
791
Thanks ridders and pbaldy. I'll take a look at the link #2 next week. Though I didn't mention, I did do the decompile prior to starting over. Left it out of original post since the result was the same (loss of vbmodules). Regarding msysobjects, I did not intentionally import any of that, didn't tick on anything and also only MSysCompactError table showed up. When importing, I simply clicked on select all when choosing the tables, queries and forms, without looking at the individual tables as I didn't see or expect msys to get imported. Even though all was working trouble free today, maybe to be extra safe, I'll create a new db and import only the objects I created, see if there are msys ticks and untick those and also remove all vb code including the form's and paste in the form code, be a pain to realign the events though.

Thanks pbaldy, we did have a few network issues last week, so maybe that contributed, though why it would affect the file today is odd. In future, I will run the front end on my hd since you say should be fine to link to common data on the network.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:44
Joined
Feb 28, 2001
Messages
27,001
we did have a few network issues last week, so maybe that contributed, though why it would affect the file today is odd

Cause the corruption yesterday, trip over it today. No real mystery. It is just a matter of some disk buffer getting whacked, the write-back breaks something, but you don't see the damage until you return to the scene of the crime.
 

sxschech

Registered User.
Local time
Today, 03:44
Joined
Mar 2, 2010
Messages
791
This is kind of a follow up to my earlier post...
I was reviewing some code in a vba standard module (not related to the open form) and all of a sudden it switched back to the form (which was in normal view). My hands were no where near the keyboard or mouse. I noticed the form flicker (no flicker prior to the switch).

I have a new theory about this ongoing issue. Seems to happen periodically. I noticed that the desktop is flickering too and looks like what appears to be happening is IT is performing a sweep and checking for certain icons on the desktop. If certain Icons are not there, they get restored. I tested that by deleting an icon and then seeing it reappear during the times when the flickering and program window switching happens. Just need to be sure I am not typing or highlighting stuff during the sweep or I may lose or unintentionally modify data/code, which may have led to the original code loss from the original post.
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 05:44
Joined
Feb 28, 2001
Messages
27,001
Just for the record, I saw you had updated this. It is possible that some tool your IT group is using could cause issues but I would need to know more about what they were doing - and how - before I could decide if I even had anything else to offer on this topic.
 

sxschech

Registered User.
Local time
Today, 03:44
Joined
Mar 2, 2010
Messages
791
I took your advice and contacted the IT dept. The person on the phone said I needed to contact the regional IT rep and I'm am continuing to wait to hear back (if at all) as this is considered a low priority issue.
 

Users who are viewing this thread

Top Bottom