[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 722
  • Last Modified:

Why Can't I Open Several Forms in an Access 2003 .mdb file?

I cannot open several forms in Form View or Design View in my .mdb file.  In fact, I imported these forms from many other .mdb files and I can't open them even if I rename them.  Some forms do have subforms and I can open the subforms in Form View and Design View.  The forms have embedded queries and  external ones too.  The queries and tables work.
Here is what I CAN do:
1. Export all objects into a new .mdb file and then compile and compact & repair (CCR): Forms will still not open.
3. Export it to a new .mdb file, CCR, and re-import it and CCR: Cannot open the forms in either file.
4. View the code behind the forms (I open another object in design view and search for a word that is in the form I can't open): I can copy all the code and save it in a txt file.  But when I try to paste it back into the form, Access closes.

I  CANNOT:
1. Copy and Paste a form into the same .mdb file.  I get error: "The Microsoft Jet database engine could not find the object '[what ever I named the form]".  Make sure the object exists and that you spell its name and path name correctly.
0
bobbat
Asked:
bobbat
  • 5
  • 4
  • 4
  • +2
6 Solutions
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You're probably dealing with corrupt forms.

You can try to decompile the database where the forms reside. To do that, build a Shortcut with this as the Target:

"full path to msaccess.exe" "full path to your database" /decompile

Make a Backup FIRST.

If that doesn't work, you can try the undocumented SaveAsText and LoadFromText methods to see if you can recover them.

1) Export your forms as Text like this (from the Immediate window):

SaveAsText acForm, "YourFormName", CurrentProject.Path & "\YourFormName.txt"

2) Build a new, blank database. Now, again in the Immediate window:

LoadFromText acForm, "YourFormName", CurrentProject.Path & "\YourFormName.txt"

If that works, do it for each of your trouble forms.

0
 
bobbatAuthor Commented:
Can you help me with the syntax?  

I get a compile error, "Expected: End of Statement"

SaveAsText acForm, "frmItemHistoryCombo", TSG IMDB FE 10.2.4.mdb.C:\Documents and Settings\bobbat\Desktop\IMDB & "\frmItemHistoryCombo.txt"
0
 
Rey Obrero (Capricorn1)Commented:


the syntax is

        Application.SaveAsText acForm, "frmItemHistoryCombo", "C:\Documents and Settings\bobbat\Desktop\IMDB\frmItemHistoryCombo.txt"
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Try this in the immediate window just as shown ... but don't put a ? in front of the line

SaveAsText acForm, "frmItemHistoryCombo", CurrentProject.Path & "\frmItemHistoryCombo.txt"

Put your cursor at the end, then hit the Enter key.

mx



0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You don't need to use the Application qualifier ... your problem is that your 3rd argument isn't formed properly:

SaveAsText acForm, "frmItemHistoryCombo", "C:\Documents and Settings\bobbat\Desktop\IMDB\frmItemHistoryCombo.txt"

0
 
bobbatAuthor Commented:
I tried both:
SaveAsText acForm, "frmItemHistoryCombo", CurrentProject.Path & "\frmItemHistoryCombo.txt"

and

Application.SaveAsText acForm, "frmItemHistoryCombo", "C:\Documents and Settings\bobbat\Desktop\IMDB\frmItemHistoryCombo.txt"

Both cause Access to Close.  Any ideas?
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
0
 
bobbatAuthor Commented:
OK, I used their service in August 2008 and it works but there was a lot to do after I got the recovered file back from them.
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
What can I say ?

Again ... did you try the Decompile as LSM suggested above ??

mx
0
 
bobbatAuthor Commented:
Yes, I ran:
"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE" "C:\Documents and Settings\bobbat\Desktop\IMDB\TSG IMDB FE 10.2.4.mdb" /decompile

This command ran correctly but I still have the bad forms.

Maybe I'll submit the fee as an "Other Direct Cost" and get reimbursed (for the second time)?
0
 
harfangCommented:
Don't let it happen a third time.

When developing, you need to make hourly backups. At every new version, I restart at 1 and just keep on making copies:

    MyApp 12b.mdb <--- version under construction
    MyApp 12b 001.mdb <--- copy made 8:15
    MyApp 12b 002.mdb <--- copy made 8:55
    ....

When I have a stable version, I release 12b and start over with 12c (or 13).

Form corruption occurs more frequently when editing live class modules. Main forms are relatively stable, but the code from subforms should not be edited while the subform is open. Or rather, it should because it's a very convenient way to debug them in context, but you should always have a backup less than an hour old before doing so. Editing one class module can corrupt another module, so your entire project is concerned.

If you need a recovery service for forms (as opposed to data), then you should revise your version control scheme.

Just my 2 cents.

(°v°)
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
"backup less than an hour old"

For me ... it's about every 20 minutes ... since I can't remember what code I wrote 21 minutes ago.  I TOTALLY agree and recommend this concept.  Relatively speaking  ... as stable as A2003 is ...
S*** happens, not if, but when ... so, *frequent* backups really can save your A**.

mx
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I use Visual Source Safe and it's saved my bacon several times. I check my objects in about every hour or so, depending on exactly what is going on.

0
 
bobbatAuthor Commented:
I used http://www.everythingaccess.com and in short order (and $149) they had an uncorrupted file for me.  Their process seems very automated so the company's owners must be zillionaires by now.  Eleven little-used forms lost their design information (I have not edited these forms in years) but all the code was recovered (which I had already copied).  They said 34 queries were bad but only four had problems--not sure what triggered the other 30 as bad--they run fine.  I tried removing everything they said was broke from the file I sent them but it still would not work.  They did manage to reduce the file size from my all-time low of 65MB to 50MB.  Not sure what is in that 15MB difference but apparently I don't need it.  The .mdb file runs a lot faster now.  Nothing I have been working with in the last several months was corrupted so I'm not sure what happened.  Maybe those electrons do what they want to do no matter what. . .
0
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Glad to hear you got your app back. Be diligent about backups, and look into some form of versioning, as suggested by harfang, or a source code control system (like VSS).
0
 
harfangCommented:
I'm glad you are back on track.

> Not sure what is in that 15MB difference but apparently I don't need it.

This seems consistent with what you can get from the "/decompile" switch, or from transferring everything to a new database (in text mode). For each VB module, and while developing them, several intermediate compilation states get saved in order for them to run even when some portions can't be compiled yet. This creates an "internal bloat", different from the normal bloat resulting from editing records and from saving entire objects. This "internal bloat" is copied along with the object, and isn't caught by "compact and repair".

Good luck with your project from now on!
(°v°)
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 5
  • 4
  • 4
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now