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??
David,

I think you need to declare gnum at the module level (i.e. in the
declarations section) not in the Form_Load event.

Also I think it would be more efficient to declare gnum as:

    dim gnum(1 to 8) as variant

as this will allow gnum to hold strings, numbers etc. as appropriate.

HTH

Peter


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

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



Sun, 08 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