HELP: what am i doing wrong?? 
Author Message
 HELP: what am i doing wrong??

here is my code:

' tmp1 & tmp2 are declared as public in a module

Private Sub Command1_Click()
tmp1 = 1
genstoped = False
Do While getstoped = False
For i = 1 To 8
    x = Int(Rnd * 8)
Next i

'  THIS IS WHERE IT MESSES UP, SAYS SUB OR FORM FUNCTION NOT DEFINED  I just
want to add integers from an array.

    If gnum(1) + gnum(2) + gnum(3) + gnum(4) + gnum(5) + gnum(6) + gnum(7) +
gnum(8) = 15 Then tmp2 = gnum(1) & gnum(2) & gnum(3) & gnum(4) & gnum(5) &
gnum(6) & gnum(7) & gnum(8)
Loop

End Sub

Private Sub Command2_Click()
genstop = True
End Sub

Private Sub Command3_Click()
Unload Me
End Sub

Private Sub Command4_Click()
Label3.Caption = genstoped
End Sub

Private Sub Form_Load()
Dim gnum As Variant
gnum = Array(1, 1, 1, 1, 1, 1, 1, 1)

genstoped = False
Label3.Caption = genstoped

End Sub

' If you can help me please do...

--
Thanks
David L...

<-- Remove .nospam to reply -->



Sun, 08 Apr 2001 03:00:00 GMT  
 HELP: what am i doing wrong??
It seems odd as to what you are doing, however, the problem seems to be
'gnum'. It is declared in the form load procedure. Move it to the
declaration section so it can be seen by the Command1_Click sub.

Note also that you may get an 'array out of bounds' error on gnum(8). By
default, the first position in the array is 0 ( ie 0 to 7) , not 1 (ie 1 to
8). If you want it to be 1 then add 'Option base 1' to the declaration
section


Quote:
>here is my code:

>' tmp1 & tmp2 are declared as public in a module

>Private Sub Command1_Click()
>tmp1 = 1
>genstoped = False
>Do While getstoped = False
>For i = 1 To 8
>    x = Int(Rnd * 8)
>Next i

>'  THIS IS WHERE IT MESSES UP, SAYS SUB OR FORM FUNCTION NOT DEFINED  I
just
>want to add integers from an array.

>    If gnum(1) + gnum(2) + gnum(3) + gnum(4) + gnum(5) + gnum(6) + gnum(7)
+
>gnum(8) = 15 Then tmp2 = gnum(1) & gnum(2) & gnum(3) & gnum(4) & gnum(5) &
>gnum(6) & gnum(7) & gnum(8)
>Loop

>End Sub



Mon, 09 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. HELP: what am i doing wrong??

2. HELP - What Am I Doing Wrong

3. Help: What am I doing wrong?

4. HELP: what am i doing wrong??

5. Help with syntax. What am I doing wrong

6. Help on GPF...what am I doing wrong???

7. What am i doing wrong here????? HELP

8. Recordset: What am I doing wrong?

9. What am I doing wrong??

10. What am I doing wrong?

11. What am I doing wrong?

12. What am I doing wrong?

 

 
Powered by phpBB® Forum Software