Mdb-file crash sometimes during design fase!

  • Thread starter Niklas Östergren
  • Start date
N

Niklas Östergren

Hi!

It hase happend twice now during the last 2 weeks. I make some codings,
compile the code without any problem. I test ren the code and it works just
great. BUT when I´m about to save the application I get a msg:

- Application can´t be saved.


If I close the application I lose my code.

The first time this happend it was´n any big deal because I hadn´t done so
much coding. But 1 hour ago I made a misstake and closed the application
without first copy all coding into a textfile or so. So I lost 4 hour´s of
work :-(

The thing is that I work with the application on different computors and I
use a USB-memmory to transport the application between the pc:s. So I wnt
back to work to see if the application that I was working on last eavning
was corrupt or not. But it wasn´t, it was working just fine and I could make
changes and save the complete application. But on the copy which I brought
with me home last eavning I can´t!???

Anyone knows about this problem and what I can do to avoid it in the future?

TIA!
// Niklas
 
A

Allen Browne

Hi Niklas.

Yes, this is a corruption, and there could be multiple causes.

Assuming you have the SP for both Office and JET (both absolutely crucial),
suggestions would be:

1. Make sure Name AutoCorrect is off.

2. Don't edit the code while it's running, i.e. switch stop the code if it's
in break mode, and switch the form to design view before modifying.

3. Don't modify an mdb that is being used by anyone else at the same time.

4. Decompile at the first hint of corruption.

5. The undocumented SaveAsText and LoadFromText may help recover a corrupted
form/report/module.

6. If the mdb is running from the USB drive, use the Stop in the Windows
system tray before unplugging the drive.

Other suggestions and details:
http://members.iinet.net.au/~allenbrowne/ser-25.html
 
N

Niklas Östergren

Hi Allen!

And thanks a lot for a quick reply!

I don´t know what you mean with SP so please give me an explanation!

Now, when you explain to me the multiple causes that could do this I do
recognize a probbable caus the two times I have had this. It´s #2.

This morning I actually did modifyed the db in breake mode. So this could
cause the problem.

Now I´m back where I left earlyer today and the code runns just as nice as
it didd before I stupidly deleted it by answering NO to the Q given by the
system. So now I´m happy again :)

I´ll look into this forum a little bit later today and see if I have got any
reply. But untill then:

Thanks a lot for taking time Allen!

// Niklas
 
A

Allen Browne

Sorry. SP = Service Pack. You need to make sure you have SP8 for JET 4, as
well as whatever is the latest service pack for your version of Access (1
for 2003, 3 for 2002, and 3 for 2000). All available in the Downloads
section of support.microsoft.com.

The SPs are so crucial, that we display them on the Help | About screen of
all Access applications we develop. Details:
http://members.iinet.net.au/~allenbrowne/ser-53.html

The issue of not editing in break mode, I don't have hard evidence for, but
when we twigged onto this issue as a cause of corruption and stopped editing
the code except in design view, our corruptions fell from several a day to
perhaps a couple a week. That was in A97, and - along with other issues - we
are now down to one every 3 - 4 weeks of heavy development in A2003. Without
evidence, I believe that the corruption occurs because Access confuses all
the copies of the code that it is juggling: the canonical version (the text
you edit), the compiled version (the binary that runs), and then the
temporary copies of these that Access creates at the point when you begin
editing a form (so you can revert to the saved copy). The evidence that
caused us to twig onto this: we saw a fully compiled project (i.e. Compile
is greyed out on the Debug menu) that Access believed was still fully
compiled after modifying the code in break mode, and it coincided with a
corruption, so the speculation that it is incorrectly juggling the various
copies is circumstantially supported. Hope it helps you.
 
N

Niklas Östergren

OK, I get it!

I now realise that I need to download some SP both for Windows, Access and
Jet. I have been running this computer, atbhome, for almost 3 years without
installing any SP of any kind. So it seams as a good idéa to do so now,
before anything realy nasty happens.

Thanks for helping out Allen. Now I´m going to bed since it´s 23:35 i Sweden
and ít´s a day tomorrow as well.

// Niklas
 
N

Niklas Östergren

Hi Again!

I couldn´t go to sleep yet. I just hade to try to change the db that I made
some changes at the work pc earlyer today. Just to see if my problem was
that I hade made desig changes in breake mode. But it wasn´t! :-(

I have brought me several different copys of the db, in different stages (I
made copies after hand when I worked) but NONE, I repet NONE is possible to
save after compiling on my home pc. Inspite I havn´t had any problem with
this before. At both pc:s I run A2002, but home I run Win XP and at work Win
2000 Professional.

I asume you recommend me to download and install the SP for both Access and
Jet!? If this doesn´t work what else, reinstall Access?

TIA and Good Night!
// Niklas
 
A

Allen Browne

Niklas, the installing the service packs does not solve the problem, it's
time for some troubleshooting to pinpoint which form/module is giving the
issue. Will walk you through that if necessary.
 
N

Niklas Östergren

Good morning Allen!

Well, the thing is that everything works just great at 2 of 3 pc:s and the
differences is that on the pc that it doesn´t work on have Win XP installed.
During the morning I have reinstalled Access 2002 on that pc but still have
the same problem.

Right now I´m at work, since we have much faster connection to Internet, to
download the servicepack you where talking about. At home I have a 56kb
modem so each servicepack takes more than 1,5 hour to download.

Do you still think that I have some coding problem with some of my modules
or form´s?

This problem have accured once earlyer, as I have mentioned, and what I did
then is that I opened a backup from one day earlyer and copied the changes
in. After that everything was just fine until yesterday.

If I have some problem in a form/module I think I allready know which one it
is. It´s a form module for a form with name < frmNewMemberShipRegistration
. But I´m not 100% sure!

If you don´t beleve that I´ll solve the problem with installing the
servicepak then I realy appreciate if you could give me a hand with the
trouble shoutings.

// Niklas
 
N

Niklas Östergren

Hi Allen!

Shall I skip the servicepack´s and go back home and try to troubleshoot, or
what do you recommend me to do right now?

I´m about to download the servicepacks but I´m not quit shure which one I
need (there are so many). Right now I have downloaded following:

JET
- WindowsXP-KB829558-x86-ENU.exe

Windows XP
- WindowsXP-KB837001-x86-ENU.EXE

Office XP
- Oxpsp1.exe
- OxpSp2.exe

TIA!
// Niklas
 
A

Allen Browne

I do expect it's a corruption.

Basic steps to rebuild are:
1. Verify that Name AutoCorrect is off in the old database. Decompile.
Compact.

2. Create a new (blank) database, and immediately turn off Name AutoCorrect
boxes under:
Tools | Options | General.
Set the minimal references you actually use. This might be a low as 3.
Details:
http://members.iinet.net.au/~allenbrowne/ser-38.html

3. Import all the tables and queries:
File | Get External | Import
using the Advanced button in the import wizard to grab any import specs of
custom toolbars as well.

4. Close the new file, and make a backup. As soon as things go wrong, you
will want to pick up from this point again.

5. If it's one particular form/module that gives you the problem, try
importing all the others, and test that it all works as expected. Use
SaveAsText to export that bad form from the old database into a text file,
and LoadFromText to import it into the new database. If that works, you're
done.

6. If #5 does not work, start again with the file created at step 4, and
programmatically export the forms, modules, and reports to text, and load
them back.

The code below illustrates how you can programmatically export all the
objects of one type (e.g. all forms) to text, and then import them:

----------------starts ends------------------------
Function ExportObjects(lngObjectType As Long) As Long
'Purpose: Create text files of all of the objects of a specified type.
'Argument: Number between 2 and 8 (see array below).
'Return: Number of objects exported.
Dim db As DAO.Database
Dim dox As DAO.Documents
Dim doc As DAO.Document
Dim strFile As String
Dim lngKt As Long
Const conPath = "C:\MyFolder\"
Dim SysObs(8, 2) As String

'These are the names and indexes of the containers, with a file
extension of my choice.
'SysObs(0, 0) = "DataAccessPages"
'SysObs(0, 1) = "dap"
'SysObs(1, 0) = "Databases"
'SysObs(1, 1) = "db"

SysObs(2, 0) = "Forms"
SysObs(2, 1) = "frm"
SysObs(2, 2) = acForm

SysObs(3, 0) = "Modules"
SysObs(3, 1) = "mod"
SysObs(3, 2) = acModule
'SysObs(4, 0) = "Relationships"
'SysObs(4, 1) = "rel"
SysObs(5, 0) = "Reports"
SysObs(5, 1) = "rpt"
SysObs(5, 2) = acReport

SysObs(6, 0) = "Scripts"
SysObs(6, 1) = "scr"
SysObs(6, 2) = acMacro

'SysObs(7, 0) = "SysRel"
'SysObs(7, 1) = "srl"

'SysObs(8, 0) = "Tables"
'SysObs(8, 1) = "tbl"
'SysObs(8, 2) = acTable

Set db = DBEngine(0)(0)
Set dox = db.Containers(lngObjectType).Documents

If MsgBox("Exporting " & dox.Count & " " & SysObs(lngObjectType, 0) &
"?", vbOKCancel, "Confirm export") = vbOK Then
For Each doc In dox
strFile = conPath & doc.Name & "." & SysObs(lngObjectType, 1)
SaveAsText CLng(SysObs(lngObjectType, 2)), doc.Name, strFile
lngKt = lngKt + 1&
Next
End If
ExportObjects = lngKt

Set doc = Nothing
Set dox = Nothing
Set db = Nothing
End Function

Function ImportObjects(lngObjectType As Long) As Long
'Purpose: Create text files of all of the objects of a specified type.
'Argument: Number between 2 and 8 (see array below).
'Return: Number of objects importeded.
Dim strFile As String
Dim strPattern2Match As String
Dim strObjectName As String
Dim lngPos As Long
Dim lngKt As Long
Const conPath = "C:\MyFolder\"
Dim SysObs(8, 2) As String

'These are the names and indexes of the containers, with a file
extension of my choice.
'SysObs(0, 0) = "DataAccessPages"
'SysObs(0, 1) = "dap"
'SysObs(1, 0) = "Databases"
'SysObs(1, 1) = "db"

SysObs(2, 0) = "Forms"
SysObs(2, 1) = "frm"
SysObs(2, 2) = acForm

SysObs(3, 0) = "Modules"
SysObs(3, 1) = "mod"
SysObs(3, 2) = acModule
'SysObs(4, 0) = "Relationships"
'SysObs(4, 1) = "rel"
SysObs(5, 0) = "Reports"
SysObs(5, 1) = "rpt"
SysObs(5, 2) = acReport

SysObs(6, 0) = "Scripts"
SysObs(6, 1) = "scr"
SysObs(6, 2) = acMacro

'SysObs(7, 0) = "SysRel"
'SysObs(7, 1) = "srl"

'SysObs(8, 0) = "Tables"
'SysObs(8, 1) = "tbl"
'SysObs(8, 2) = acTable

strPattern2Match = conPath & "*." & SysObs(lngObjectType, 1)
strFile = Dir$(strPattern2Match)
Do While Len(strFile) > 0&
lngPos = InStrRev(strFile, "\")
strObjectName = Mid$(strFile, lngPos + 1)
lngPos = InStrRev(strObjectName, ".")
If lngPos > 0& Then
strObjectName = Left$(strObjectName, lngPos - 1)
End If
'Debug.Print SysObs(lngObjectType, 2), strObjectName, conPath &
strFile
LoadFromText SysObs(lngObjectType, 2), strObjectName, conPath &
strFile
strFile = Dir$
lngKt = lngKt + 1&
Loop

ImportObjects = lngKt

End Function
----------------code ends------------------------
 
A

Allen Browne

You definately need the Service Packs.
Make sure they are applied before you do the rebuild.

There is an SP3 for Office XP, but I don't think it's critical.
 
N

Niklas Östergren

OK!

That´s a long list and several of the task have I never done before so this
is going to be fun!

I must say that you deffinatly provide a verrsy good help Allen and I want
you to know that I´ll realy appreciate it.

I have downloaded the SP3 for Win XP as well (118 kb/s as real speed is quit
fast, I wish I hade that at home :) )

I´ll work throug your list and get back to you as soon as I have something.
Latest thoug this evening since I go to UK early tomorrow morning and won´t
be able to read/write at this forum until next friday. Yes england DO have
access to the web but I don´t at the hotel I´m staying ;-)

Best reguards!
// Niklas
 
N

Niklas Östergren

Hi Again Allen!

I´m not shure where to find Name AutoCorrect (to switch it off. I do now
where Alternative for AutoCorrect, but that´s now what you mean, or?

// Niklas
 
N

Niklas Östergren

Hi Allen!

Next time I´ll bloddy remember this! You see that the problem is solved and
NOW I remember that last time it was the same reason. $?{?{$£${[[]][{?$££@@

I have a reference to a mdb to logg all the errors in the db. And I have
this db on different locations on the pc:s. I will change this emidiatly so
I´ll store this db at the same location on ALL machines.

I found this when I loocked at the reference since I was looking for where
to switch Name AutoCorrect off. At the same time I was also looking for
where to Decompile the code, since I only find Compile.

I´m sorry for all the trouble I have caused you and realy appreciate the
time and effort you have put in to my problem. Thank´s a lot Allen!

Best Reguards!
// Niklas
 
N

Niklas Östergren

Hi Allen!

I hope you saw my msg that I posted about this problem that it was now
solved! I had problem with a reference to a external db for logging error´s.
After that reference was set everything worked ok again. But strangely only
for one of the copies that I have for the latest db.

So I´ll keep on working with the one that works.

Thank´s a LOT for all help!

Best Reguards!
// Niklas
 
Top