Biggles1
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-re quests-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?
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\
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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I realize my typo: It should have been acImportDelim
ASKER
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.
New questions should be started in new threads.