Stepping through Recordset on Timer Interval

  • Thread starter holmstj via AccessMonster.com
  • Start date
H

holmstj via AccessMonster.com

I am trying to move through a recordset at a predetermined timer interval to
display a strip gauge on form that will change value base on row field values
in the recordset. I have run into my limitations of VBA knowledge and need
some help. I thought I might be able to pass the rs back to the timer but it
seem not to work.Please see snippet below:

Private Sub Form_Timer()
'get paramaters from recordsource DFDR Data
BrakeP3 = rsData(rs.Fields("BRAKEPress3"))
rs.MoveNext

'Move bar chart
SetBarChart BrakeP3, 100, 3000

End Sub

Public Function SetBarChart(x As Single, xmin As Single, xmax As Single)
If x <= xmin Then
Me.BarChartBar.Height = 0
ElseIf x >= xmax Then
Me.BarChartBar.Top = Me.BarChartScale.Top
Me.BarChartBar.Height = Me.BarChartScale.Height
Else
Me.BarChartBar.Height = ((x - xmin) / (xmax - xmin)) * Me.
BarChartScale.Height
Me.BarChartBar.Top = Me.BarChartScale.Top + Me.BarChartScale.Height -
Me.BarChartBar.Height
End If
Me.BarChartBar.Visible = True
End Function

Sub rsData(rs As Recordset)

Set rs = CurrentDb.OpenRecordset("DFDR Data", dbOpenForwardOnly)
rs.MoveFirst

End Sub

Variable not defiened error is given when run
Thank for any help and suggestions.
Jeff
 
H

holmstj via AccessMonster.com

Thanks Alex. However, when I try to set rs by opening a recordset in a module
I get an error that 'set' is a invalid outside procedure. Not real
experienced using modules so I am sure it is me. I have tried just opening
the recordset through the form's open event but can not refer to 'rs' in the
timer event. I can do it in the OnTimer event but it opens the recordset
each time the event occurs which is every half second.

Jeff
 
H

holmstj via AccessMonster.com

Alex,

I understand know. That got it working.

Thanks for the help

Jeff
 

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