Thanks for all the help..........
"Jesper Fjølner" wrote:
[Quoted Text] > > Yes. That is exacly what we are trying to do. Use link table(s). But we > > are > > trying to automate the process. Click of a button, load the data into SQL > > Server tables. How is this possible with text import ? > > Have you tried the > Docmd.TransferText command? > > I think that's the fastest option. > > This also works. I'm assuming a file "c:\1.txt" with three numbers per line > seperated by a space as: > 5 6 7 > 7 8 9 > 12 23 56 > > and then this should work (but is not the fastest way I think). > > Dim intFileNo As Integer > Dim strLine As String > Dim arr() As String > Dim db As Database > > intFileNo = FreeFile() > Open "C:\1.txt" For Input As #intFileNo > Set db = CurrentDb > ' Læs alle linjer > 'Begintrans 'optional may speed it up > Do While Not EOF(intFileNo) > Line Input #intFileNo, strLine > arr = Split(strLine, " ") > db.Execute ("INSERT INTO tablename (f1,f2,f3) VALUES (" & arr(0) & "," & > arr(1) & "," & arr(2) & ")"), dbFailOnError > Loop > 'CommitTrans - optional may speed it up > Erase arr > Close #intFileNo > > > > Jesper Fjølner > > >
|