I think I based this code on an MSDN article but I'm not sure.
The SQL script deletes and re-creates the table.
(DELETE * would be just as good but this way I can change
the table def'n in the script.)
The problem is that the INSERT command fails with "Categorized_Records already exists"
If I allow Access to use the contents of the text file to guess at the table design, how is it going to know what the field names should be, the maximum length of the text fields, and which fields are currency?
Aside: I like the way we have to call them "currency" and "text" in the GUI but use "money" and "char" in SQL
--
Wes Groleau
Code:
SQL_Script(Program_Dir & "New_Cat_Records.sql")
Using Access_Conn As New System.Data.OleDb.OleDbConnection _
(Access_Conn_String)
Access_Conn.Open()
' Due to internal semicolon, this can't be in above script
Dim Access_Command As New System.Data.OleDb.OleDbCommand _
("SELECT * INTO Categorized_Records " & _
"FROM [Text;DATABASE=C:\Temp].[For_270.txt]", _
Access_Conn)
Access_Command.ExecuteNonQuery()
Access_Conn.Close()
End Using
(DELETE * would be just as good but this way I can change
the table def'n in the script.)
The problem is that the INSERT command fails with "Categorized_Records already exists"
If I allow Access to use the contents of the text file to guess at the table design, how is it going to know what the field names should be, the maximum length of the text fields, and which fields are currency?
Aside: I like the way we have to call them "currency" and "text" in the GUI but use "money" and "char" in SQL
--
Wes Groleau