tags:

views:

577

answers:

10

When importing forms in access using loadfromtext, I continually get a runtime error 2285. Searching the internet shows many people with the same problem, yet no solutions. Does anyone know what causes this bug?

Edit: In addition a file called 'errors.txt' is created in the folder containing the database.

Edit: Sort of solution: I never got around to asking my system operator about the hotfixes, but the function did work as expected at home. I logged in this morning and it works here to (no changes to ms access in the mean time). I'm guessing this is an internal bug in ms access, not in the vba code.

If you experience the same error, try a cold reboot, wait a while and hopefully you the problem goes away. If you could list the specific circumstances under which the error occured maybe the bug can eventually be found.

Finally in related news: At http://www.mvps.org/access/modules/mdl0045.htm an access addin can be found to export your forms/tables. This one has been verfied to work, so you can check if the problem is in your own code or some access bug.

P.S. Thanks Remou for your patience and help. I've upvoted the hotfix answer because it seems to be closest to the eventual solution.

A: 

What code are you using? Are you using a new database?

This discussion shows various solutions: http://www.utteraccess.com/forums/showthreaded.php?Cat=&Number=1385079&page=&view=&sb=5&o=&vc=1

Remou
A: 

Yep I'm using a new database. I'm trying to set up a system where you have all form definitions as text files so that they can be version controlled, and that there is a clean database that is 'compiled' based on these text representations.

the code I'm using is a basic

Application.LoadFromText acForms, left(filename, len(filename)-len(".frm.txt")), filename

I have checked (by stepping through the code using F8) that the formname is correct and the filename is correct and including the drivename

Jauco
A: 

Is that a cut and paste, because there is an error: acForm, not acForms.

Have you tried with values:

Application.LoadFromText acForm, "FormX", "C:\Docs\FormX.txt"

To eliminate any possible problems with the code?

Remou
A: 

That was a typo in my comment, not the original code.

I created a new clean database in c:\windows\temp, I copied the text export there as well. And I ran the code

Application.LoadFromText acForm, "testName", "c:\windows\temp"

from the new clean database. (after I restarted access). Still the same error.

Jauco
A: 

There still seems to be a syntax problem:

Application.LoadFromText acForm, "testName", "c:\windows\temp\testname.txt"
Remou
A: 

I'm sorry, that code that I entered in access did have a filename appended.

I tried running the function with a deliberately misspelled filename and that gave a different error so I assume that the function is able to find the file I specify

Jauco
A: 

What version of Access are you using? Have you applied all the updates etc?

As an aside, it is usually easiest to cut-and-paste code or code snippets, that ensures that any small errors will be spotted.

Remou
A: 

My version is Office Access 2003(11.8166.8221) SP3

Jauco
+1  A: 

There are problems with SP3, have you applied the hotfix?

http://support.microsoft.com/default.aspx/kb/945674

Remou
+2  A: 

This problem is related to errors occuring for users of the Access Source Code Control Integration.

The solution can be found here: http://support.microsoft.com/kb/927680 "This issue occurs if the Access default file type differs from the file type for the Access database that is in the Visual SourceSafe project."

In other words: The default file type found in "Tools -> Options -> Advanced -> Default file format" is different from the file format of the database you are using LoadFromText on, or from the database you used SaveAsText on. The file format of the database can be found in the Access title bar.

Marien