Article ID: 109393
Article Last Modified on 1/18/2007
OnClick: =WriteFile()
Caption: Import Text
NOTE: In Microsoft Access version 1.x, the OnClick property is called
the OnPush property.
Option Explicit
Function WriteFile ()
' These variables store the text of the file.
Dim Linedata as String
Dim WholeFile as String
' Open the file.
Open "C:\CONFIG.SYS" For Input As #1
' Continue reading until end-of-file.
Do While Not EOF(1)
' Read a line of data.
Line Input #1, Linedata
' Store each line of data in the WholeFile variable.
WholeFile = WholeFile + Chr(13) & Chr(10) + Linedata
Loop
' Transfer contents of file to text box on form.
Forms!Form1![My_Text1] = WholeFile
' Close the data file.
Close #1
End Function
Forms!Form1![My_Text1] = Null ' Erases the text.
Keywords: kbhowto kbprogramming KB109393