Spin numbers like a slot machine

S

stockwell43

Hello,

I was wondering if it was possible to create a small form with three fields
say field1, field2 and field3 with three buttons one under each field called
button1, button2 and button3.

I am looking to place a start button on the top of the form which will have
numbers and letters spin in each field like a slot machine and when the
button is clicked under each field, it will stop the field from spinning.

Also, I would like to know inaddition to this, if I can make the buttons so
that if one is clicked the field starts spinning and if clicked again, it
stops.

I am looking to make a little fun type gadget for a fun raiser within our
department and thought access would be a good tool to make some simple fun.

Thanks!!!
 
J

Jon Lewis

Matybe this will be a start for you:
(cmd1 is initially Enabled)

'******************************
'******************************
Option Compare Database
Option Explicit

Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim mbStop1 As Boolean

Private Sub cmd1_Click()
mbStop1 = Not mbStop1
If mbStop1 = False Then Spin1
End Sub

Private Sub cmdStart_Click()
Me.cmd1.Enabled = True
mbStop1 = False
Spin1
End Sub

Private Sub Spin1()
Static i As Integer
Do
DoEvents
If mbStop1 = True Then
Exit Do
End If
Me.txt1 = i
i = IIf(i = 9, 0, i + 1)
Sleep 100
Loop
End Sub
'*****************************
'*****************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top