PSUIVERSON
Technical User
I am attempting to import a .txt file into MS ACCESS 2000 using VBA.
Here is my rough attempt - I am stuck right off the bat because I am trying to call on a database I haven't created yet!? So I guess
Sub importTEXT()
Dim db As Database
Dim rst As Recordset
Dim field0 As Variant
Dim field1 As Variant
Dim field2 As Variant
Dim field3 As Integer
Dim field4 As Variant
Dim field5 As String
Dim tablename As Variant
Open "c:\file.txt" For Input As #1
tablename = "TABLE" & Date
Set dbs = CurrentDb
Set tdf = dbs.TableDefs(tablename)
Do While Not EOF(1)
Input #1, field0
Input #1, field1
Input #1, field2
Input #1, field3
Input #1, field4
Input #1, field5
* Here I would like to take these variables and begin writing them into the .mdb file
Loop
End Sub
Any help would be appreciated!
Thanks
PSUIVERSON
Here is my rough attempt - I am stuck right off the bat because I am trying to call on a database I haven't created yet!? So I guess
Sub importTEXT()
Dim db As Database
Dim rst As Recordset
Dim field0 As Variant
Dim field1 As Variant
Dim field2 As Variant
Dim field3 As Integer
Dim field4 As Variant
Dim field5 As String
Dim tablename As Variant
Open "c:\file.txt" For Input As #1
tablename = "TABLE" & Date
Set dbs = CurrentDb
Set tdf = dbs.TableDefs(tablename)
Do While Not EOF(1)
Input #1, field0
Input #1, field1
Input #1, field2
Input #1, field3
Input #1, field4
Input #1, field5
* Here I would like to take these variables and begin writing them into the .mdb file
Loop
End Sub
Any help would be appreciated!
Thanks
PSUIVERSON