Form Problem

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

Hi All

I have been designing a database and I have not backed up in a couple of
days (yeah I know I'm an idiot). Anyway the main form I have been working
on seems to have gotten corrupt. I can't open the form in either Form View
or Design View. I can seem to access the code but I cant access the form.
I have tried the following:

1. Compacting and repairing the database
2. Importing the file into a new database
3. Exporting the file into a different database
4. Saving the form with a different name

Nothing seems to work and when doing some of the above I get a record in an
error table that says "cant open form"

Anyone have any ideas on if I can get into this form or I am screwed and
should start trying to redo everything?

Thanks for any thoughts,

Jeff
 
Firstly make a back-up of the database, even corrupted and always try on a
copy so that you can always start another repair attempt at the same
starting point.

1. Try the decompile method:
http://www.trigeminal.com/usenet/usenet004.asp?1033

2. Try the SaveAsText and LoadFromText method. I haven't got the link
handy but you should be able to search Google using these keywords.
 
Hi Jeff,

Do you have a known good back-up copy of this database, which may have older
data, but has a current copy of the form in question? If so, try deleting the
form, compacting the database, and importing the same form from the known
good copy of your database.

If you don't have such a back-up, try using the following steps on a copy of
your database. First, I assume you can open this form in design view. Is this
correct? If your answer is yes, try the following:

1.) Open NotePad

2.) Open the form's code module. Copy the code associated with this form
(Ctrl C) and paste it (Ctrl V) into NotePad. Save the text file.

3.) Set the Has Module property for the form to No. Save the form.

4.) Open the Immediate Window (Ctrl G) and issue the following command. I
have used C:\Temp as the example folder. Use a valid path for your PC.

Application.SaveAsText acForm, "NameOfForm", "C:\Temp\NameOfForm.txt"

5.) Delete the form. Compact the database.

6.) Open the Immediate Window (Ctrl G) and issue the following command:

Application.LoadFromText acForm, "NameOfForm", "C:\Temp\NameOfForm.txt"

7.) Create a new code module for this form. Copy the code from the text file
you previously saved, and paste it into the recovered form's code module.
Remove any duplicate declarations that you may have at the very top.

Notes:
You should see Option Explicit as the second line of code in your new
module. If not, add this line manually. Then set your VBA options so that you
will always get this line in all new modules that you create. See the
following Gem Tip if you are not sure what this is all about:

Always Use Option Explicit
http://www.access.qbuilt.com/html/gem_tips.html#VBEOptions

Although Application.SaveAsText and Application.LoadFromText can be used
with forms and reports that include associated code modules, I have had
better luck in the past by first saving the associated module to a text file,
and then just saving & restoring the object by itself, adding a module back
in after the restore step.

8.) Click on Debug > Compile ProjectName. Test the functionality.


Good Luck.


Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
Hi Tom

I can not open the form in Design view and when I do try to use the
Saveastext (thanks for the code for this) on my form it hangs access and
boots me out.

And the older database has a 2 day old version of the form in question. I
can see and copy the code from the module window but I am starting to think
that I will need to re-create the missing objects I added over the last 2
days - unless anyone has any other suggestions.

Thanks,

Jeff
 
Hi Jeff,

Unless you want to pay for professional recovery services (Peter Miller, of
PK Solutions, is very good), I'm afraid that you are probably screwed.
However, to inject a little humor into your situation, here is a tune that
you can sing to yourself <smile>

Yesterday,
All those backups seemed a waste of pay.
Now my database has gone away.
Oh I believe in yesterday.

Suddenly,
There's not half the files there used to be,
And there's a panic
coming over me
The system crashed so suddenly.

I pushed something wrong
What it was I could not say.

Now all my data's gone
and I long for yesterday-ay-ay-ay

Yesterday,
The need for back-ups seemed so far away.
I knew my data was all here to stay,
Now I believe in yesterday.

Author Unknown



Tom Wickerath
Microsoft Access MVP

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________
 
Hi, Jeff,

RAR or ZIP the database and e-mail it to Streamline at seznam dot cz. I'll
try to recover it for free.

Vlado

P.S. I promise I won't steal any code. :-)
 
Back
Top