Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any ideas when I open a sequential 2

Status
Not open for further replies.

M626

Programmer
Mar 13, 2002
299
Any ideas when I open a sequential file and try to set a number or characters as a Variable, I can't?

I am using this?

Dim AA As Single

sFilePathIn = "SpoolOut.raw"
If Not fsoIn.FileExists(sFilePathIn) Then
fsoIn.CreateTextFile (sFilePathIn)
End If
Set fFileIn = fsoIn.GetFile(sFilePathIn)
Set tStreamIn = fFileIn.OpenAsTextStream(ForReading, TristateFalse)

Do While tStreamIn.AtEndOfStream <> True
sdata = tStreamIn.ReadLine

AA = Mid(sData, 12, 3)
Text2.Text = AA
 
You've got AA defined as a Single.

You are trying to put the result of a MID function into this variable. MID returns a string, not a numeric value, so you will get an error.

You could do this:

AA = Val(Mid(sData, 12, 3))

to get it to convert it to a numeric value.

Or did you intend to dim AA as a string instead?

Robert
 
mid returns a string, why not just set Text2.Text = mid(sData12,3)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top