Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-20-2018, 10:21 AM   #1
sxschech
Newly Registered User
 
Join Date: Mar 2010
Posts: 612
Thanks: 28
Thanked 112 Times in 101 Posts
sxschech is on a distinguished road
Strange behaviour - hands free switched between vba window and access window lost vba

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:
Quote:
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.

sxschech is offline   Reply With Quote
Old 07-20-2018, 12:53 PM   #2
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,575
Thanks: 92
Thanked 1,682 Times in 1,560 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: Strange behaviour - hands free switched between vba window and access window lost

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.
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 07-20-2018, 02:42 PM   #3
sxschech
Newly Registered User
 
Join Date: Mar 2010
Posts: 612
Thanks: 28
Thanked 112 Times in 101 Posts
sxschech is on a distinguished road
Re: Strange behaviour - hands free switched between vba window and access window lost

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.

sxschech is offline   Reply With Quote
Old 07-20-2018, 03:09 PM   #4
isladogs
High Noon Moderator
 
isladogs's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 11,036
Thanks: 115
Thanked 3,020 Times in 2,747 Posts
isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold isladogs is a splendid one to behold
Re: Strange behaviour - hands free switched between vba window and access window lost

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/microsoftacces.../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...d.php?t=293579
__________________
If this answer has helped, please click the Thanks button and/or click the 'reputation scales' symbol on the left.

Colin (Mendip Data Systems)
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


Website links:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


I know that you know that we both know nothing

Last edited by isladogs; 07-20-2018 at 11:25 PM. Reason: Spelling
isladogs is offline   Reply With Quote
Old 07-20-2018, 04:04 PM   #5
pbaldy
Wino Moderator
 
pbaldy's Avatar
 
Join Date: Aug 2003
Location: Nevada, USA
Posts: 33,306
Thanks: 13
Thanked 4,113 Times in 4,045 Posts
pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold pbaldy is a splendid one to behold
Re: Strange behaviour - hands free switched between vba window and access window lost

Quote:
Originally Posted by sxschech View Post
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.
__________________
Paul
Microsoft Access MVP 2007-2019

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
pbaldy is offline   Reply With Quote
Old 07-20-2018, 06:27 PM   #6
sxschech
Newly Registered User
 
Join Date: Mar 2010
Posts: 612
Thanks: 28
Thanked 112 Times in 101 Posts
sxschech is on a distinguished road
Re: Strange behaviour - hands free switched between vba window and access window lost

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.
sxschech is offline   Reply With Quote
Old 07-20-2018, 09:36 PM   #7
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,575
Thanks: 92
Thanked 1,682 Times in 1,560 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: Strange behaviour - hands free switched between vba window and access window lost

Quote:
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.

__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 08-14-2019, 09:43 AM   #8
sxschech
Newly Registered User
 
Join Date: Mar 2010
Posts: 612
Thanks: 28
Thanked 112 Times in 101 Posts
sxschech is on a distinguished road
Re: Strange behaviour - hands free switched between vba window and access window lost

This is kind of a follow up to my earlier post...
Quote:
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 by sxschech; 08-14-2019 at 09:44 AM. Reason: changed word from early to earlier
sxschech is offline   Reply With Quote
Old 08-14-2019, 10:52 AM   #9
The_Doc_Man
Happy Retired Curmudgeon
 
Join Date: Feb 2001
Location: Suburban New Orleans, LA, USA
Posts: 14,575
Thanks: 92
Thanked 1,682 Times in 1,560 Posts
The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold The_Doc_Man is a splendid one to behold
Re: Strange behaviour - hands free switched between vba window and access window lost

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.
__________________
I'm a certified grandpa (3 times now) and proud of it.
Retired over one year and survived being home all day with the wife. She must really love me.
If I have helped you, please either click the thanks or click the scales.
The_Doc_Man is offline   Reply With Quote
Old 08-22-2019, 12:47 PM   #10
sxschech
Newly Registered User
 
Join Date: Mar 2010
Posts: 612
Thanks: 28
Thanked 112 Times in 101 Posts
sxschech is on a distinguished road
Re: Strange behaviour - hands free switched between vba window and access window lost

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.

sxschech is offline   Reply With Quote
Reply

Tags
compact repair , failure , form , vba

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Strange problem with Relationship window... Rhagir General 2 09-18-2012 05:32 PM
Self Joins: Query Window Versus Relationships Window wilderfan Theory and practice of database design 5 03-09-2009 09:19 AM
Lost Focus event does not fire when clicking external window willjones Forms 8 06-13-2007 08:23 AM
Strange Window Size Problem WendyE SQL Server 4 04-19-2006 04:07 PM
Help: Pass argument from Child window to Parent window? galantis Forms 4 02-22-2005 02:41 PM




All times are GMT -8. The time now is 06:29 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World