Run-time error 3027 problem

  • Thread starter Thread starter Steve Elliott
  • Start date Start date
S

Steve Elliott

Not certain if this is an Access or a Visual Basic problem. Hopefully,
someone can spread some light.



I am running MS Access 2000 on a Win XP (Home) laptop. I am also running MS
Access 2000 on a Win 95 PC. My Access Database comprises a data import
module, which works fine on the Win 95 machine, but on the XP machine,
throws up the following error message:



Run-time error 3027

Cannot update - Database or object is read-only.



As far as I'm aware the Access installation is the same on both machines.
It has been suggested there may be a security element that needs checking or
unchecking. The location of the data file that's being imported is slightly
different, so have amended the path in VB module. This element appears to
work okay.



Any ideas, suggestions would be useful, as (1) the data file being imported
is not set to read-only, and as mentioned works fine on the Win 95 PC
anyway.



Thanks.



Steve.
 
Steve Elliott said:
Not certain if this is an Access or a Visual Basic problem.
Hopefully, someone can spread some light.



I am running MS Access 2000 on a Win XP (Home) laptop. I am also
running MS Access 2000 on a Win 95 PC. My Access Database comprises
a data import module, which works fine on the Win 95 machine, but on
the XP machine, throws up the following error message:



Run-time error 3027

Cannot update - Database or object is read-only.



As far as I'm aware the Access installation is the same on both
machines. It has been suggested there may be a security element that
needs checking or unchecking. The location of the data file that's
being imported is slightly different, so have amended the path in VB
module. This element appears to work okay.



Any ideas, suggestions would be useful, as (1) the data file being
imported is not set to read-only, and as mentioned works fine on the
Win 95 PC anyway.

The XP machine has the latest version of Jet, which only allows text
import from files with a limited number of file-extensions. See this KB
article for an explanation and fix:

http://support.microsoft.com/default.aspx?scid=kb;en-us;245407
 
Do you know if you can delete a line in a registry key to eliminate the
problem ? The file I import daily has numbered file extensions which
increase by one every day.

Alternatively can you use wildcards or "from" and "to", ie 235-400.

Can't see any mention of this in the article and subsequent links below.

Thanks.
 
Doug,

The only snag is that the import module imports, then reads and calculates,
all in one go. It uses the file extension number as a guide, as it's tied
in with the data on the file that needs importing.

I don't have enough experience at editing VB modules and fiddling about
underneath Access Databases to be confident. For me, it would be easier to
get the registry to simply work with what I already have, as it does under
the Jet version that comes with Win 95.

Thanks for your help, but would certainly like some pointers at either
editing or deleting the registry line that's causing this problem.

Steve.
 
Presumably you've got code that can import the file (or at least would if
the file extension was valid). The code I gave you was complete: there's
nothing more you need to do. But I'll change it ever so slightly, and all
you'll have to do is add 5 lines to your existing module (a 1 line
declaration at the beginning, 3 lines before your existing code, and one
line after).

Assuming that your code is using strFileName as the name of the file being
imported, try the following:

Add this declaration line:

Dim strOriginalFile As String

Add these three lines before your existing code (somewhere after strFileName
has been assigned a value, but before the import takes place):

strOriginalFile = strFileName
strFileName = strFileName & ".txt"
Name strOriginalFile As strFileName

Add this one line after your existing code:

Name strFileName As strOriginalFile

(If you're using a different variable than strFileName, replace all
occurences of strFileName above with whatever variable name you're using)

Realistically, if you're not comfortable editing VB modules, then I'd
strongly suggest that you should not be attempting to mess with the
registry. An error can cause your computer to become non-functional! If
you're determined, though, I kind of like the code you can download from
http://www.thescarms.com/vbasic/registry.asp
 
Doug,

Thanks for the advice and pointers. Would ideally not like to mess around
with the registry, so will try the VB amendment option.

Thank you !

Steve.
 
Doug,

This is a copy of the code from my VB module in it's Declarations/File
Name/Import Data sectors:
--------------------------------------------------------------------
Option Compare Database

Global Tempfile As String
-------------------------------------------------------------------
Public Function Import_Data()

If IsNull(Forms![Sales Analysis by Destination]![Text39]) = True Then
Exit Function
End If

DoCmd.TransferText acImportDelim, "Fgwtrans331 Import Specification",
"Import Table", Filename(), False
DoCmd.SetWarnings False
DoCmd.OpenQuery "Append Filename"
DoCmd.OpenQuery "Attach Data"
DoCmd.OpenQuery "Delete from Import Table"
DoCmd.SetWarnings True

End Function
----------------------------------------------------------------------------
--------------
Public Function Filename()

Filename = "d:\fgwtrans." & Forms![Sales Analysis by Destination]![Text39]

End Function
----------------------------------------------------------------------------
 
Back
Top