Re: Importing file.csv into Access using a VBS

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi John,

Thank you again! I have included below a peace of my script and I'm getting
this error --> "Table 'Table1' already exists, Code: 800A0BC2, source:
DAO.Database" Please, let me know how can I solve this. Thank you!

For j = 0 To oDB.TableDefs.Count - 1
If oDB.TableDefs(j).Name = TableName Then

strSQL = "INSERT INTO " & TableName _
& " SELECT * FROM [Text;HDR=Yes;Database=" & FolderPath _
& ";].[" & TextFileName & "#" & Extension & "];"
oDB.Execute strSQL

Else

strSQL = "SELECT * INTO " & TableName _
& " FROM [Text;HDR=Yes;Database=" & FolderPath _
& ";].[" & TextFileName & "#" & Extension & "];"
oDB.Execute strSQL
End If
Next

--
Message posted via http://www.accessmonster.com
.



Relevant Pages

  • Re: Moving flat file to a mainframe
    ... launches a script that uses DAO to execute a query that exports the ... 'Sample VBScript to export data from an MDB database to a CSV file ... Dim oTDef 'As DAO.TableDef ... Dim strSQL 'As String ...
    (microsoft.public.access.modulesdaovba)
  • Re: SQLScripts
    ... Alternatively you could put VBA code into the new MDB and run it ... statements that do the work of the T-SQL script you have in mind. ... Dim oJet 'DAO.DBEngine ... Dim strSQL 'String ...
    (microsoft.public.access.conversion)
  • Re: Problem Using DoCmd.RunSQL
    ... I had the forms mis-named in the script! ... the form loaded into the control To test that, ... Dim strSql As String ... Below is the command I am using from a button on a form to add a line to ...
    (microsoft.public.access.forms)
  • Re: Help with VB SQL Script
    ... Ray at work ... I had alot of help with this script in a previous post. ... > objRS.Open strSQL, objConn, 3, 3 ...
    (microsoft.public.scripting.vbscript)
  • Re: Handling OLD files
    ... below peace of code u list of files, ... I am need this in a script for moving/erase old files from a ... Santosh Patil ...
    (perl.beginners)