Link to home
Start Free TrialLog in
Avatar of Biggles1
Biggles1Flag for United States of America

asked on

Importing a CSV file in my database

I use the following code to import a csv file into my database:

Private Sub cmdImport_Click()
On Error GoTo Err_cmdImport_Click:
Dim dbs As Database
Dim strSQL As String

DoCmd.SetWarnings False

Set dbs = CurrentDb

DoCmd.TransferText acExportDelim, "DelimWO-1", "tblImported", "C:\Users\AllPC\Downloads\Service-requests-08-22-18"

Exit Sub
MsgBox Err & " " & Err.Description
End Sub

The table tblImported is already created (otherwise I get an error that it cant find it!)

When I run the program I get: 3027 Cannot Update.  Database Object is Read-Only.  I tested the table tblImported and it is NOT read-only

Any ideas?
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

TransferText with the acExportDelim argument will EXPORT your data, not IMPORT it. Your expression would export data from a table named tblImported to a file at the address in that last argument (which is not properly formed - you should have a filename at the end).
Avatar of PatHartman
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Biggles1


I realize my typo: It should have been acImportDelim
Jo Winograd gave me some extensive answers.  Now I cant find them!  Please help.
I'm not sure how we can help with this.  If you look in your profile, you should be able to see all the questions you asked.  Where the answers in some question you asked?  If not, try pinging Jo but ypu'll have to provide more detail since I'm sure she answers lots of questions.

New questions should be started in new threads.