D
Darryl Brooks via AccessMonster.com
Hi
We are trying to utilize a VB Script to import a (IIS file) CVS file into
an MS Access Database (Ver.2002 SP3) table without opening the database.
A)We have tried the "make table query method" and the "append query
method".
We utilize the following "append query" SQL string:
strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " &_
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"
The following error message is received:
The INSERT INTO statement contains the following unknown field name:"F1":
Make sure you have typed the name correctly, and try the operation again.
B)The make table query method does import the data but our IP Address field
is converted to a currency field.
'strSQL = "SELECT * INTO tblFileImport FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"
Question: How do we control the Microsoft Jet Engine with a "Make Table
query" to specify field data type during import?
CODE UTILIZED:
dim oJet
dim oDB
dim strSQL
dim rs
Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase("D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\TestGroup.mdb")
strSQL = ""
'Use Append or Make Table query HERE
'strSQL = "SELECT * INTO tblFileImport FROM " & _
strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " & _
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * " & _
"FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"
'RESPONSE.WRITE "<B>Query String: </B>" & strSQL & "<BR>"
oDB.Execute strSQL
oDB.Close
Thank You
DB
We are trying to utilize a VB Script to import a (IIS file) CVS file into
an MS Access Database (Ver.2002 SP3) table without opening the database.
A)We have tried the "make table query method" and the "append query
method".
We utilize the following "append query" SQL string:
strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " &_
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"
The following error message is received:
The INSERT INTO statement contains the following unknown field name:"F1":
Make sure you have typed the name correctly, and try the operation again.
B)The make table query method does import the data but our IP Address field
is converted to a currency field.
'strSQL = "SELECT * INTO tblFileImport FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"
Question: How do we control the Microsoft Jet Engine with a "Make Table
query" to specify field data type during import?
CODE UTILIZED:
dim oJet
dim oDB
dim strSQL
dim rs
Set oJet = CreateObject("DAO.DBEngine.36")
Set oDB = oJet.OpenDatabase("D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\TestGroup.mdb")
strSQL = ""
'Use Append or Make Table query HERE
'strSQL = "SELECT * INTO tblFileImport FROM " & _
strSQL = "INSERT INTO tblFileImport (UserIPAddress, " & _
"UserName, " & _
"LogDate, " & _
"LogTime, " & _
"Service, " & _
"ComputerName, " & _
"WebServerIPAddress, " & _
"TimeTaken, " & _
"BytesReceived, " & _
"BytesSent, " & _
"ServiceStatusCode, " & _
"WindowsStatusCode, " & _
"RequestType, " & _
"TargetOfOperation, " & _
"Placeholer) SELECT * " & _
"FROM " & _
"[Text;HDR=No;Database=D:\Inetpub\wwwroot\httproot\MlogsReports\
UsageReports\;FMT=Delimited].ucscan_041905#txt"
'RESPONSE.WRITE "<B>Query String: </B>" & strSQL & "<BR>"
oDB.Execute strSQL
oDB.Close
Thank You
DB