Results 1 to 4 of 4
  1. #1
    lca88 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2017
    Posts
    2

    Importing .dat Files

    I have had success importing dat files into a table from one computer. When attempted from a second computer, I received run-time error 75 - Path/File access error. Here is the code behind the button which I came across when trying to find a resolution to import dat files.

    The portion in red is where the error occurs. Will the File/Copy function only work if the user has full access to the local drive? Thanks for any insight.

    Private Sub cbImportLocMain_Click()
    Dim strInputFileName As String


    Dim strExt As String
    Dim strFileTemp As String
    Dim f As Object

    strInputFileName = ahtCommonFileOpenSave(OpenFile:=True, _
    DialogTitle:="Please select an input file...", _
    Flags:=ahtOFN_HIDEREADONLY)


    If Len(strInputFileName) - 1 > 0 Then
    strExt = Mid(strInputFileName, Len(strInputFileName), ".")
    End If

    strFileTemp = Replace(strInputFileName, strExt, "_Temp.txt")

    FileCopy strInputFileName, strFileTemp

    DoCmd.TransferText acImportDelim, , "tblLocMainR0", strFileTemp, True

    Kill strFileTemp

    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    does the OpenFileDialog work correctly?
    are you using drive letters? or UNC paths?
    Is the file in the correct format?

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    What is in strFileTemp? Put a break point on the FileCopy line, then when it stops, mouse over strFileTemp and see if that path is correct.

  4. #4
    lca88 is offline Novice
    Windows 10 Access 2010 64bit
    Join Date
    Apr 2017
    Posts
    2
    No, the file dialog does not open for me to select a file. I would assume this is why FileCopy does not work - there is nothing copy. Big oversight on my part.

    strInputFileName = ahtCommonFileOpenSave(OpenFile:=True, _
    DialogTitle:="Please select an input file...", _
    Flags:=ahtOFN_HIDEREADONLY

    For other instances in the db, I have used Application.FileDialog to select a file for import with success. ahtCommonFileOpenSave is used because I could not figure out how import a dat file and I found an application someone published for importing dat files. I ran it on one computer and it worked and am now trying on a different box and have not had success.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Importing and formatting CSV files
    By T_Tronix in forum Import/Export Data
    Replies: 0
    Last Post: 04-01-2016, 12:44 PM
  2. Importing PDF Files?
    By swicklund in forum Access
    Replies: 1
    Last Post: 12-27-2013, 09:35 AM
  3. Importing Excel Files
    By sathishkm in forum Import/Export Data
    Replies: 2
    Last Post: 10-02-2013, 04:16 PM
  4. Importing pdf files
    By Road Runner in forum Import/Export Data
    Replies: 1
    Last Post: 04-02-2013, 10:00 PM
  5. importing Dbase files
    By dzawicki in forum Import/Export Data
    Replies: 2
    Last Post: 01-14-2010, 05:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums