TextBox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.
I have a table with information that i'd like to display on a textbox.
What i'd like to do is to loop through the table records and display one at
a time with a 5 second interval. When it reaches the last record, it starts
all over again from the first one.

Can anyone help me?

Thanks
 
Luis,

Put this in the Declarations section of your form:
Private bCancel As Boolean
Private rs As DAO.Recordset

Put this somewhere in your form:
Set rs = CurrentDb.OpenRecordset("SELECT ........", dbOpenSnapshot)
Me.TimerInterval = 5000

Put this in the form's Timer() event:
If (bCancel = True) Then
Me.TimerInterval = 0
rs.Close
Else
Me!txtMyTextBox = rs!SomeField
If rs.EOF Then rs.MoveFirst Else rs.MoveNext
End If

Finally, add the following code to the form's Unload() event:
Set rs = Nothing

bCancel is used to break the loop. Use a CommandButton to set bCancel =
True.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Worked perfectly!
But now how can i create a sliding effect on it. It can be right-to-left or
down-to-up, etc?
 
Luis,

Private Sub Timer()
Dim iPos As Integer

If (bCancel = True) Then
Me.TimerInterval = 0
rs.Close
Else
'Slide left-to-right
For iPos = Len(rs!SomeField) To 1 Step -1
Me!txtMyTextBox = Mid(rs!SomeField, iPos)
'You'll probably need to put some delay in here
Next iCount

If rs.EOF Then
rs.MoveFirst
Else
rs.MoveNext
End If
End If
End Sub

BUT, you might be more inclined to use this:
http://www.lebans.com/hscroller.htm

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------
 
Back
Top