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!

Run-time error '458'

Status
Not open for further replies.

SmokinWrek

IS-IT--Management
Jun 20, 2002
36
US
Help! I'm getting this error on a Get statement, and I don't understand why. Here's the section of code that's giving me problems:

Dim Banner() As BannerRec
Dim NumRecs, Counter As Double
Dim BoxSize, NumBoxes, NumPerPage As Integer
Dim InputRec, BannerOut As String
Open txtInputFilename.Text For Random As #1 Len = InpRecLen
Open txtOutputFilename.Text For Random As #2 Len = InpRecLen
NumRecs = (LOF(1) / InpRecLen)
NumPerPage = Val(txtNumberPerPage.Text)
BoxSize = NumPerPage * 2000
NumBoxes = NumRecs \ BoxSize
ReDim Banner(1 To NumBoxes, 1 To 2, 1 To NumPerPage)
If NumRecs > BoxSize Then
For z = 1 To NumBoxes
For i = 1 To BoxSize
Get #1, (i + ((z - 1) * BoxSize)), InputRec
Counter = Counter + 1
Put #2, , InputRec
Next i

... code drifts off into spaghetti


It's probably something stupid I'm doing, but like I said, I get the "Run-time error '458' Variable uses an Automation type not supported in Visual Basic" on the Get statement. Can anyone point out my error?

Kevin
 
youre retrieving something you should be inserting...

get file#, fileIndex, fileRecord

if im right, you'll need to set a variable as the file structure in your datafile

Type YourRecord as record
...
InString as String
...
end type

dim MyRec as YourRecord

get #1, (maths), MrRec.InString

but obviously tailored for your needs

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
That wouldn't work, unfortunately, as the file structure will change from file to file.

Also, that's not the reason this isn't working..... I stumbled accross the help file and actually read it completely and it said something about when reading into a variable length string with a Get statement from a file opened as Random, it reads a 2-byte record length descriptor.

Anyway, I changed it so I open the file for input and I changed my Gets to Inputs and my Puts to Prints, and got it to work.

Thanks anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top