How to populate a label from text file.

  • Thread starter Thread starter GA
  • Start date Start date
G

GA

Would some kind soul help me out with this please.

I want to display the text from a text file in an unbound control on
my main form. The purpose is to display the establishment using the
database.

The front end and back end plus are in the same directory with the
text file which is created by my installer which. Details of the
establishment are collected during the install and then written to the
text file.

TIA - GA
 
Dohhh....

As soon as I hit the send button it dawned on me that I could just
link to the file as a table.

I was looking for a complicated solution when a simple one existed 8^)

GA
 
GA said:
I want to display the text from a text file in an unbound control on
my main form. The purpose is to display the establishment using the
database.

The front end and back end plus are in the same directory with the
text file which is created by my installer which. Details of the
establishment are collected during the install and then written to the
text file.


Here's a form Load event procedure that loads a text box
with the contents of a text file:

Private Sub Form_Load()
Dim file As Long
Dim buf As String
Dim path As String
Dim filesize As Long
file = FreeFile()
path = "D:\path\file.txt"
filesize = FileLen(path)
Open path For Input As file Len = filesize
buf = input(filesize, file)
Me.Text0 = buf
Close file
End Sub
 
Many thanks Marshall.

GA

Here's a form Load event procedure that loads a text box
with the contents of a text file:

Private Sub Form_Load()
Dim file As Long
Dim buf As String
Dim path As String
Dim filesize As Long
file = FreeFile()
path = "D:\path\file.txt"
filesize = FileLen(path)
Open path For Input As file Len = filesize
buf = input(filesize, file)
Me.Text0 = buf
Close file
End Sub
 
Back
Top