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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot import or export a .dat file 1

Status
Not open for further replies.

JanTeb

Programmer
Nov 24, 2003
6
CA

this used to work and then all of a sudden stopped without any changes being made. In code I find all .dat files and show them in a import screen when I click the file I want an error comes up "You cannot open this file" with only an ok button option. When I try to write a .dat file I get an error "Database or Object is read-only". I can import and export .txt, .tmp but not .dat (or .abc either for that matter)
Here is the import code (export is very similar):
On Error GoTo BErr
Dim strFile$
dlgFile.FileName = ""
dlgFile.CancelError = False
dlgFile.DialogTitle = "Open Import Data File"
'dlgFile.InitDir = App.Path
dlgFile.Filter = "Fuel Import (*.dat)|*.dat|Text Files (*.txt)|*.txt|All Files (*.*)|*.*"
dlgFile.DefaultExt = "dat"
dlgFile.FilterIndex = 0
dlgFile.ShowOpen
strFile = dlgFile.FileName
If strFile = "" Then
Exit Function
End If
DoCmd.TransferText acImportDelim, "Fuel Import", "Fuel", strFile
 
Hi

You have switched version of Access from A97 to 2000 or later yes?

In A2000 and later only declared extenstions can be imported, or you get misleading "Read Only" error

Change extension (say to .txt) or edit registry to add .dat to list of allowed extensions

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top