Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fitered record display not correct 1

Status
Not open for further replies.

Fiat77

Programmer
Feb 4, 2005
63
0
0
US
When I invoke a filter I have the following code on my OnCurrent event fo the Form. Problem is that after they do a filterBySelection it always displays
Filtered record 1 of 1 even though there are more than 1 total records. if they advance 1 record it correctly displays.

How can i correct this so that my text box instantly displays the correct filtered record count?

*************Code**********************

On Error GoTo ErrHandle_Err

If Me.NewRecord Then

Me!txtRecDisplay = "New Claim " & Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount + 1
ElseIf Me.FilterOn = True Then

Me!txtRecDisplay = " Filtered Claim " & Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount
Else
Me!txtRecDisplay = "Claim " & Me.CurrentRecord & " of " & Me.RecordsetClone.RecordCount
End If


ErrHandle_Exit:
Exit Sub

ErrHandle_Err:
MsgBox Error$
Resume ErrHandle_Exit
 
Your code may not be giving the form enough time to load all of the filtered records. Try adding:

Me.RecordsetClone.MoveLast

Before using:

Me.RecordsetClone.RecordCount

This will ensure that all records have been accounted for before displaying a count.


Hope this helps,
Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top