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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input # Array

Status
Not open for further replies.

DaProgrammer

Programmer
May 27, 2004
22
US
Is there any alternative to using Input # array (which is not possible)?!? I have 659 numbers that must be assigned to 659 objects in an array.

The file is written like this...

N = req1(0).Value
T = Label1.Caption
Open "C:\MeritBA\" + T + ".mbd" For Output As #1
Write #1, N
For i = 1 To 659
Write #1, req1(i).Value
Next
Write #1, Label1.Caption
Close #1

I was attempting to open it like this....

filename = OpenDia1.filename
Open filename For Input As #1
Form8.Show
For i = 0 To 659
Input #1, Form8.req1(i).Value
Next
Close #1
End Sub

and I got an error. Is there anyway to do this?!? Form8.req1( 0 through 659 ).value are all checkboxes

PLEASE PLEASE PLEASE HELP!

-Eric
 
Hi and welcome to Tek-Tips. To get the best from the forum, read faq222-2244 carefully.

You don't say what your error message is, or what line it occurs on, so we're a bit in the dark!

A couple of points spring to mind:

1. You appear to be saving 659 integers and 1 string:[tt]

For i = 1 To 659
Write #1, req1(i).Value
Next
Write #1, Label1.Caption
[/tt]
and then assigning those 660 values to checkboxes:[tt]

For i = 0 To 659
Input #1, Form8.req1(i).Value
Next
[/tt]
Unless label1.Caption happens to be coerceable to 0, 1 or 2 then you'll get an error. Unless you have 660 checkboxes you will also get an error.

2. I would avoid using property names as Variable names as it may lead to confusion and errors.
[tt]
filename = OpenDia1.filename
[/tt]

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
john and others-
my apologes for the confusion.

it is 659 chkboxes and on label that is being opened. I forgot that part.... but i still get an error. Here is what the code on the opening end really is

Open filename For Input As #1
Form8.Show
For i = 0 To 659
Input #1, Form8.req1(i).Value
Next
Form8.Label1.Caption
Close #1

it is when i try to open the file when i get the error....
Variable required - Can use this expression in regaurds to: Form8.req1(i).Value.

My question is how can i do this same thing without using that expression.

The 659 integers are ones and zeros representing chked or unchked boxes. It is to open previous work in the same format to pick up where one left off in the program.

The one string is the title which is merely "along for the ride" and is getting assigned to a Label on the opening end.
 


Dim lngTemp as long
Dim strTemp as string


Open filename For Input As #1
Form8.Show
For i = 0 To 659
Input #1, lngTemp
Form8.req1(i).Value = lngTemp
Next
Input #1, strTemp
Form8.Label1.Caption = strTemp
Close #1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top