Next Tip   Access 2000/2002/2003 Export To Text Bug/Safety Measure

After a frustrating afternoon trying to work out why exporting to text was failing after converting a database from Access 97 to 2000, this page will demonstrate what you will need to do to solve the problem.

If you are visiting this page, you are probably searching for the words "export database or object is read-only". Anyway the problem is caused by using a file type that is not allowed by Access 2000. Some posts on this issue indicate that you can change the registry to fix this problem, if you find the right registry entry, please let us all know.

Anyway in the following code, you will see how to export to a file using the txt extension followed by a rename of the file to a new extension (str) using the Name method. This solves the problem in a roundabout way.

Private Sub cmdXFaceSurpac_Click()
On Error GoTo Err_cmdXFaceSurpac_Click

Dim DocName As String
Const STRINGFILE As String = "face1"
Const TEXTEXT As String = ".txt"
Const STREXT As String = ".str"
DocName = "FX_XtheFaceSurpac"

DoCmd.TransferText acExportDelim, "FX_surpac", DocName, _
 Me![txtFolder] & STRINGFILE & TEXTEXT, True, ""
 
Kill Me![txtFolder] & STRINGFILE & STREXT
Name Me![txtFolder] & STRINGFILE & 
 TEXTEXT As Me![txtFolder] & STRINGFILE & STREXT
MsgBox "Transfer to " & Me![txtFolder] & STRINGFILE & STREXT & " is complete.",  _
  vbInformation, "Surpac String File"

Exit_cmdXFaceSurpac_Click:
Exit Sub

Err_cmdXFaceSurpac_Click:
MsgBox Error$
Resume Exit_cmdXFaceSurpac_Click
end sub

You can read more about this at
http://support.microsoft.com/kb/245407/en-us

Note: You can also effect Exports by modifying the key
HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\4.0\Engines\Text\DisabledExtensions

Why not try one of the articles at our website

Add a Global Error Handler To Your Page
Replace Your File API’s With The FileDialog Object

Click on the Next Tip button for the next page in this Access Loop.

 

Our Tools and Resources

  • RSS & Newsletter Here
    Join our newsfeed or sign up for our informative newsletter on Office Automation, Access and VB topics
  • Get Good Help
    If you need help with a database, our Australian Professionals could be the answer

  • Smart Access is online 
    The best magazine written about Microsoft Access is now being transferred to the web. There are 400 articles written by a 100 authors in the collection. 

    Purchase Smart Access

  • The Workbench
    Find out who has your database open, start the correct version of Access, easy compacting and backups, change startup options, creation versions,  shutdown database

  • Read about the Toolbox
    Sample downloads, library resource kit and searchable help file comprising most of the information at vb123.com.au plus hidden downloads etc. Includes one of Smart Access downloads.

  • Convert Access to SQL Server  
    Upsize to SQL Server 2005 or 2008, easily repeated conversions, highly accurate SQL query  translation and web form conversion.
  • Purchase the Popular FMS Products  
    If you purchase the Popular FMS products from us, you will receive a complimentary of Smart Access Gold, Silver or Bronze Collections [Your choice]

 

 

vb123 Professionals


Get Good Help Here

If you need help with a database or Office programming, our Professionals could be the answer because we have worked on many similar solutions



Frontpage Conversions
We have converted vb123.com to Expression Web, contact us if we can help you move to the latest Microsoft web tool.


About The Editor ~ Contact Us
Garry Robinson writes for a number of popular computer magazines, is now a book author and has worked on 100+ Access databases. He is based in Sydney, Australia

Access 2003 Security

MS Access Security

Read More here