tags:

views:

99

answers:

3

This is Access 2003. From an access database code module, I am opening two outside access databases and then saving the text of two forms that exist in both of the databases. I am executing the statements:

Call app1.SaveAsText(acForm, "MyForm", "c:\MyForm_app1.txt")
Call app2.SaveAsText(acForm, "MyForm", "c:\MyForm_app2.txt")

Both app1 and app2 are of type Access.Application.

I receive the error: Method 'SaveAsText' of object ' Application' failed

This error only happens on this specific app2 form. Other forms in app2 are saving just fine. I am using Access 2003. There was a trial of Access 2007 installed but now that is removed. I am still getting the same error.

Thanks for your help. I am really puzzled over this one.

+1  A: 

Gotta love undocumented options. For kicks and giggles, I'd try renaming one of the two forms. Or, swap the two statements and see if app1 starts erroring. It looks like the forms has identical names, perhaps Access is leaving the first one open and getting confused.

Maybe something is slightly corrupt in app2. You could always try running the /decompile option on app2 (take a backup first of course)

CodeSlave
For more information on decompile see Decompile or how to reduce Microsoft Access MDB/MDE size and decrease start-up timeshttp://www.granite.ab.ca/access/decompile.htm
Tony Toews
Here is more information. It is failing with this error number -2147417851 Automation error The server threw an exception.
Greg Finzer
A: 

That form is possibly corrupt. See if you can open that form in Access and then save it under a different name. Or import the entire database into a new file.

Tony Toews
The form is not corrupt.
Greg Finzer
So you can save the form under a different name? Can you save the form under the same name. By save I mean using the form save button and not the SaveAsText.
Tony Toews
A: 

The problem was that there is a bug in Access 2003 where it cannot handle databases converted from Access 2007 to Access 2003. The fix is to install the latest Service Pack for Office 2003.

Greg Finzer