L
LeAnn
Hi,
I have an Access 97 database. On one of my forms I have 2 fields that
display calculations from queries and a list box that displays records from
another query. The sub routine below is called when a user clicks navigation
command buttons, edits or saves the form so the controls are refreshed and
display current data. This works fine. However I want to call the sub when a
user changes from one record to another (when the users use the mouse wheel
to scroll). I called the code in the OnCurrent event (see below) of the form
but I get a memory error. Is there a better place to call this? I'm
guessing Access can't determine the current record during the OnCurrent
event. Thanks for your assistance. LeAnn
**********************
Public Sub RecordCnt(ByVal lngRecord As Long)
'Description
'This code will update the record count appropriately and refresh the data
With Me
DoCmd.GoToRecord , , acLast
lngLastRecord = .CurrentRecord
DoCmd.GoToRecord , , acGoTo, lngRecord
.lblRecords.Caption = "Record " & .CurrentRecord & " of " & lngLastRecord
.lstCycles.RowSource = "SELECT CYC_ID, CycleNum, ThawDte, FreezeDte,
HrsMin, CreatedBy FROM qryCycle WHERE MSET_ID = " & Me![MSET_ID] _
& " ORDER BY CycleNum"
.lstRoomTemp.RowSource = "SELECT HrsMin FROM qryCycleSum WHERE MSET_ID =
" & ![MSET_ID]
.lstReagentTime.RowSource = "SELECT Dys FROM qryReagentTime WHERE
MSET_ID = " & ![MSET_ID]
End With
End Sub
*************************
Private Sub Form_Current()
'Get the first record
If Me.CurrentRecord <> 0 Then
Call RecordCnt(Me.CurrentRecord)
End If
End Sub
I have an Access 97 database. On one of my forms I have 2 fields that
display calculations from queries and a list box that displays records from
another query. The sub routine below is called when a user clicks navigation
command buttons, edits or saves the form so the controls are refreshed and
display current data. This works fine. However I want to call the sub when a
user changes from one record to another (when the users use the mouse wheel
to scroll). I called the code in the OnCurrent event (see below) of the form
but I get a memory error. Is there a better place to call this? I'm
guessing Access can't determine the current record during the OnCurrent
event. Thanks for your assistance. LeAnn
**********************
Public Sub RecordCnt(ByVal lngRecord As Long)
'Description
'This code will update the record count appropriately and refresh the data
With Me
DoCmd.GoToRecord , , acLast
lngLastRecord = .CurrentRecord
DoCmd.GoToRecord , , acGoTo, lngRecord
.lblRecords.Caption = "Record " & .CurrentRecord & " of " & lngLastRecord
.lstCycles.RowSource = "SELECT CYC_ID, CycleNum, ThawDte, FreezeDte,
HrsMin, CreatedBy FROM qryCycle WHERE MSET_ID = " & Me![MSET_ID] _
& " ORDER BY CycleNum"
.lstRoomTemp.RowSource = "SELECT HrsMin FROM qryCycleSum WHERE MSET_ID =
" & ![MSET_ID]
.lstReagentTime.RowSource = "SELECT Dys FROM qryReagentTime WHERE
MSET_ID = " & ![MSET_ID]
End With
End Sub
*************************
Private Sub Form_Current()
'Get the first record
If Me.CurrentRecord <> 0 Then
Call RecordCnt(Me.CurrentRecord)
End If
End Sub