Avatar of Biggles1
Biggles1
Flag 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
Err_cmdImport_Click:
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?
Microsoft AccessVBA* import

Avatar of undefined
Last Comment
PatHartman

8/22/2022 - Mon
Scott McDaniel (EE MVE )

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).
ASKER CERTIFIED SOLUTION
PatHartman

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Biggles1

ASKER
I realize my typo: It should have been acImportDelim
Biggles1

ASKER
Jo Winograd gave me some extensive answers.  Now I cant find them!  Please help.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
PatHartman

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.