N
normalit
I am trying to import a 140-field, pipe delimited file into an access
database (obviously of the same size). When I run the script, noted
below, I get an error (noted below the script):
I have tried different scripts I have found within Google groups, but
not sure which would be the best, this is the latest I have tried:
******* Start of script, assumes Ticket_Data table is created, which it
always will be for me *****
Option Explicit
Dim oJet 'As DAO.DBEngine
Dim oDB 'As DAO.Database
Dim oTDef 'As DAO.TableDef
Dim blTExists 'As Boolean
Dim strSQL 'As String
Const DB_NAME = "C:\Documents and
Settings\normalit\Desktop\db\test.mdb"
Const TBL_NAME = "Ticket_Data"
Const DATA_SOURCE = "[Text;HDR=Yes;Database=C:\Documents and
Settings\normalit\Desktop\db;].20060406_019012#csv"
Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase(DB_NAME)
strSQL = "INSERT INTO " & TBL_NAME _
& " SELECT * FROM " & DATA_SOURCE & ";"
oDB.Execute strSQL
oDB.Close
***** End of script, ERROR Received: *****
C:\>cscript "C:\Documents and Settings\normalit\Desktop\test.vbs"
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
C:\Documents and Settings\normalit\Desktop\test.vbs(27, 1)
DAO.Database: The INSE
RT INTO statement contains the following unknown field name:
'ticket_number|peop
le_state_ckbox|police_checkbox|dcn|town'. Make sure you have typed the
n
ame correctly, and try the operation again.
****** End of code & error *****
Can anyone please explain what I need to do so it will accept each pipe
delimited field and properly import the text file into the database?
Thank you very much in advance...
database (obviously of the same size). When I run the script, noted
below, I get an error (noted below the script):
I have tried different scripts I have found within Google groups, but
not sure which would be the best, this is the latest I have tried:
******* Start of script, assumes Ticket_Data table is created, which it
always will be for me *****
Option Explicit
Dim oJet 'As DAO.DBEngine
Dim oDB 'As DAO.Database
Dim oTDef 'As DAO.TableDef
Dim blTExists 'As Boolean
Dim strSQL 'As String
Const DB_NAME = "C:\Documents and
Settings\normalit\Desktop\db\test.mdb"
Const TBL_NAME = "Ticket_Data"
Const DATA_SOURCE = "[Text;HDR=Yes;Database=C:\Documents and
Settings\normalit\Desktop\db;].20060406_019012#csv"
Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase(DB_NAME)
strSQL = "INSERT INTO " & TBL_NAME _
& " SELECT * FROM " & DATA_SOURCE & ";"
oDB.Execute strSQL
oDB.Close
***** End of script, ERROR Received: *****
C:\>cscript "C:\Documents and Settings\normalit\Desktop\test.vbs"
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
C:\Documents and Settings\normalit\Desktop\test.vbs(27, 1)
DAO.Database: The INSE
RT INTO statement contains the following unknown field name:
'ticket_number|peop
le_state_ckbox|police_checkbox|dcn|town'. Make sure you have typed the
n
ame correctly, and try the operation again.
****** End of code & error *****
Can anyone please explain what I need to do so it will accept each pipe
delimited field and properly import the text file into the database?
Thank you very much in advance...