Corrupt DB

A

AFKAFB

All
I'm convinced my DB is either possessed by the devil or ir corrupt.

I ve no ides how long ago my corruption may have occured so i decided
to salvage what i could from my current DB and start again.

The forms are the most complex so i imported only the forms to a new
database. I then stripped these forms of all code, control sources,
formula, etc. and imported these shell forms into a new a DB.

And started again.

During the rebuild i regularly used the Compact & Repair DB and
Performance Analyser function. There was no problem but just now
whilst using the Performance Analyser there was an error and Access
rebooted. Theres been no problems since but i'm wondering if perhaps
the shell forms were not as clean as i thought and in fact are
'carrying' the earlier corruption.

Would that make sense?

Also doed my rebuild approach make any sense.

I could stat from scratch nut the forms took ages to get right and
doing them again fils me with dread..

regards

chris
 
R

RuralGuy

MVP Allen Browne has a number of thoughts on this very subject.
http://allenbrowne.com/ser-47.html


All
I'm convinced my DB is either possessed by the devil or ir corrupt.

I ve no ides how long ago my corruption may have occured so i decided
to salvage what i could from my current DB and start again.

The forms are the most complex so i imported only the forms to a new
database. I then stripped these forms of all code, control sources,
formula, etc. and imported these shell forms into a new a DB.

And started again.

During the rebuild i regularly used the Compact & Repair DB and
Performance Analyser function. There was no problem but just now
whilst using the Performance Analyser there was an error and Access
rebooted. Theres been no problems since but i'm wondering if perhaps
the shell forms were not as clean as i thought and in fact are
'carrying' the earlier corruption.

Would that make sense?

Also doed my rebuild approach make any sense.

I could stat from scratch nut the forms took ages to get right and
doing them again fils me with dread..

regards

chris

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
 
A

Arvin Meyer [MVP]

First, simply import everything into a new empty database. 99 times out of a
100, this is all that's needed. Corrupt objects won't import. If you are
still having problems, go to my website and download this code:

http://www.datastrat.com/Code/DocDatabase.txt

The code uses the undocumented Application.SaveAsText syntax to save all the
objects except the tables as the code necessary to rebuild them. As long as
the file can be read, it can be saved.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
A

AFKAFB

Arvin
I coped your code into my DB.
I selected run and typed DocDatabase in the immediate window and this
message was returned

'Compile Error - User defined-type not defined'

What am i doing wrong please.

chris
 
A

Arvin Meyer [MVP]

Is there are reference set to DAO? Is that reference disambiguated? That
code, having been written 6 years ago, assumes that DAO is the only engine
reference set in the database. If you have ADO referenced, you will need to
set the DAO reference and change the code to read:

Dim dbs As DAO.Database
Dim cnt As DAO.Container
Dim doc As DAO.Document
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
A

AFKAFB

Apologies
I've now set the references to DAO Library.
Works like a dream
Lovely piece of code
Thank you
Chris
 
A

AFKAFB

Arvin
A quick question
I've saved all the objects down as per the code.
However loading them to my new DB is casusing a slight problem.

this is the code i've used (extract)

On Error GoTo Err_DocDatabase
Dim dbs As Database
Dim cnt As Container
Dim doc As Document
Dim i As Integer

Set dbs = CurrentDb() ' use CurrentDb() to refresh Collections

Set cnt = dbs.Containers("Forms")
For Each doc In cnt.Documents
Application.LoadFromText acForm, doc.Name, "R:\Basel\Basel 2
Securitisation\05 Database\Application\B2-SCC Access Model\Downloaded
access objects\" & doc.Name & ".txt"
Next doc

etc for the other objects

the code has been stored in the new data base in a module
'mdl_restore_code'

the error message is that the Access cannot open this text file.

where am i going wrong

could i simply import the text files into the new DB.

chris
 
A

AFKAFB

Arvin
Should the application.loadfromtest code be insert in a module in the
DB where the objects were saved from or sent to a new one.
i would have thought a new one but this has me stumped.
regards
chris
 
A

Arvin Meyer [MVP]

AFKAFB said:
Arvin
Should the application.loadfromtest code be insert in a module in the
DB where the objects were saved from or sent to a new one.
i would have thought a new one but this has me stumped.
regards
chris

It's LoadFromText (not test). I'd add the module to a new empty database and
import the objects into the new one.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
A

AFKAFB

Arvin

Thanks for getting back to me.

My email did say 'test' but the code does use 'text'.

I created a new DB, added a new module 'mdl_restore_code' with the
code as suggested but Access rejected it with the message

"MS Access can't open the file
'R:\Basel\Basel 2 Securitisation\05 Database\Application\B2-SCC
Access Model\Downloaded access objects\mdl_restore_code.txt'"

the module 'mdl_restore_code' is not saved down as it was only
added when I created the new DB.

The code reads as follows :

On Error GoTo Err_DocDatabase
Dim dbs As Database
Dim cnt As Container
Dim doc As Document
Dim i As Integer
Set dbs = CurrentDb() ' use CurrentDb() to refresh Collections
Set cnt = dbs.Containers("Forms")
For Each doc In cnt.Documents
Application.LoadFromText acForm, doc.Name, "R:\Basel\Basel 2
Securitisation\05 Database\Application\B2-SCC Access Model\Downloaded
access objects\" & doc.Name & ".txt"
Next doc
etc for the other objects
what am I doing wrong

regards

chris
 
A

AFKAFB

Arvin
See my note above.
I've tried this again.
I started from scratch and created a new DB.
This time the process seemed to run but in fact the vba module screen
simply closed down and nothing happened.
But what was particulatly odd is that the code changed itself back from
Application.LoadFromText to Application.SaveAsText
I don't understand that all.
Can you please let me know what you think.
chris
 
A

AFKAFB

Arvin
Ignore the above
Its returning the first message
"MS Access can't open the file 'R:\Basel\Basel 2 Securitisation\05
Database\Application\B2-SCC Access Model\Downloaded access
objects\module4"
do i need to include another addin
regards
chris
 
A

AFKAFB

Arvin
I've no idea whats happening here - its now repeating the behaviour in
no 11
regards
 
A

Arvin Meyer [MVP]

The are no forms in the container. You must use Application.LoadFromText
individually without the rest of the code. So just use it like this
(Watchout for line wrap):

Sub Whatever

Application.LoadFromText acForm, "YourFormName", "R:\Basel\Basel 2
Securitisation\05 Database\Application\B2-SCC Access Model\Downloaded
access objects\YourFileName.txt"

End Sub


--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Top