1. NEWBIE, URGENT:Please Help : Importing TabDelim txt file into Access Database
I am in desperate need of help to solve what is no doubt a very simple
problem.
I am attempting to write a VB4 application that will import a 2 field tab
delimited text
file into an Access 7 database.
I have reached the point where I have created a temporary table in the
database, and have created a link to the text file.
Below is the code used so far, I think I am going about this in the right
way, the Form_Load works OK. When I run the
cmdImport_Click routine, VB throws an invalid argument error.
If anybody can help me, I would be very gratefull.
Thanks In Advance
Andrew Jones
Sub Form_Load()
Dim NewTableDef As TableDef
'Create default workspace
Set Ws = DBEngine.Workspaces(0)
'Open the Warehouse32 Points Database
Set Db = OpenDatabase("c:\program files\warehouse32 points
database\points.mdb")
'Create a new table to temporarily hold imported salesw32
Set NewTableDef = Db.CreateTableDef("TempTbl")
'Set connection information, connects TempTbl to salesw32
NewTableDef.Connect = "Text;Database=c:\program files\warehouse32 points
database\"
NewTableDef.SourceTableName = "salesw32"
'Append TableDef to create link
Db.TableDefs.Append NewTableDef
End Sub
Private Sub cmdImport_Click()
Dim txtDb As Database
Dim txtTbl As Recordset
Dim Statement As String
Dim SearchSet As Recordset
'Open external salesw32.txt file
Set txtDb = OpenDatabase("c:\program files\warehouse32 points database",
False, False, "Text;")
'Create Recordset from table
Set txtTbl = txtDb.OpenRecordset("salesw32", dbOpenTable)
Statement = "SELECT * FROM salesw32"
Set SearchSet = txtDb.OpenRecordset(Statement, dbOpenRecordset) <------get
invalid argument here.
While Not SearchSet.EOF
AddRecord
SearchSet.MoveNext
Wend
End Sub
2. perl rebuild
3. Problem importing TXT Files
4. Help linking reports
5. Problem Importing from a TXT file
6. Join based on substrings
7. Problems when importing txt files (fixed)
8. Importing and splitting .txt files - Help!
9. Problems in DTS import TXT files
10. Problem with import from txt-file
11. Problem Importing txt files into Access