Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Corrupt form

Status
Not open for further replies.

peterv6

Programmer
Sep 10, 2005
70
US
I've created a project that consists of a couple of forms and modules with subroutines. Somehow, the last time I turned off my laptop, the .frm file became corrupted. When I try to run it in vb, I get the message:
Compile error:
Expected: identifier

The first few lines of the file look like:
Type=exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\WINNT\system32\stdole2.tlb#OLE Automation
Reference=*\G{00025E01-0000-0000-C000-000000000046}#5.0#0#..\..\Common Files\Microsoft Shared\DAO\dao360.dll#Microsoft DAO 3.6 Object Library
Reference=*\G{162760D6-2351-11D5-A914-0080AD8D3952}#1.0#0#..\..\MZTools3VB6\MZTools3.dll#MZTools3
Form = JobLeads1.frm
Form = frmHistory.frm
IconForm = "frmLeads"
Startup = "frmLeads"
HelpFile = ""

It looks like a configuration file for the frm file, then it shows the code for the modules. Since I have the code for the modules, that isn't too much of a problem, but it'd be a pain to have to recode the form. Does anyone know if there there's a way to fix this without having to recreate the form from scratch?

PETERV
Syracuse, NY &
Boston, MA
 
Your JobLeads1.frm and frmHistory.frm are nothing more than just text files and you can open them in Notepad, if you want to. Actually, you can even write code in Notepad – not very efficient way, but who is going to stop you :)

At the top of the text you will have all information about the Form and all controls (pretty interesting stuff if you’ve never looked at it). Just look for ‘Option Explicit” – that’s where your code starts.

See if you can retrieve code this way from your forms.

Have fun

---- Andy
 
That stuff is typically in the VBP (i.e. VB Project) file. The real form code usually starts with
Code:
VERSION 5.00
Begin VB.Form <name of form>

OR 

VERSION 5.00
Object = <Some Object Identifier>
Begin VB.Form <name of form>

The second version (with object or reference specifications) will also have a FRX file which is a binary form.

If you find that in notepad or wordpad then remove anything before it and try it again.

MAKE A BACKUP BEFORE MESSING WITH THE FORM USING A TEXT EDITOR
 
Type=exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\WINNT\system32\stdole2.tlb#OLE Automation
Reference=*\G{00025E01-0000-0000-C000-000000000046}#5.0#0#..\..\Common Files\Microsoft Shared\DAO\dao360.dll#Microsoft DAO 3.6 Object Library
Reference=*\G{162760D6-2351-11D5-A914-0080AD8D3952}#1.0#0#..\..\MZTools3VB6\MZTools3.dll#MZTools3

That's the top of a .vbp file, not a .frm file. Somehow the project file got saved in the form file's space. Scroll down and see if you can find the part Golom showed you. If you can, just delete everything above it - the

VERSION 5.00
Begin VB.Form frm<whatever>

(and maybe some Object = <something> lines between them) are the beginning of a .frm file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top