How do I prevent flickering?

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

I was having issues with my form not showing the correct number of records so
I put in a MoveLast and MoveFirst cycle before I get the recordcount and it
works fine but my form flickers as it cycles from last to first. I put in an
echo=false but it's still flickering. Is there another way around this?

Application.Echo False
Me.Recordset.MoveLast
Me.Recordset.MoveFirst
Application.Echo True

Me.WhichRecord = Me.Recordset.Bookmark
Me.HowManyRecords = Me.Recordset.RecordCount
 
Excerpt for the case where the number of records is above 10000, the correct
number of records should be displayed if you have chosen the right type of
recordset.

You should tell us more about this particular recordset and using
MoveLast/MoveFirst is probably not the best solution.
 
Jeff said:
I was having issues with my form not showing the correct number of records so
I put in a MoveLast and MoveFirst cycle before I get the recordcount and it
works fine but my form flickers as it cycles from last to first. I put in an
echo=false but it's still flickering. Is there another way around this?

Application.Echo False
Me.Recordset.MoveLast
Me.Recordset.MoveFirst
Application.Echo True

What about this?

Me.Painting = False
Me.Recordset.MoveLast
Me.Recordset.MoveFirst
Me.Painting = True


But nevertheless I agree with Sylvain. - There may be something wrong
with your approach in general.

Cheers
Phil
 
My recordset is less than 10,000. For whatever reason it doesn't return then
correct RecordCount even though the new Recordset is correct. The reason I
need the correct RecordCount is that I have a custom navigation bar and I re-
populate WhichRecord and HowManyRecords when a filter( new RecordSource ) is
applied. Here's the orginial code:

Dim Dealer As String
Dim SQLString As String

Dim rs As New ADODB.Recordset
Dim Conn As ADODB.Connection

Me.Requery

Dealer = InputBox("Please enter the Dealer Name", "Search", "")

SQLString = "EXEC dbo.SearchDealer " & Dealer

Set Conn = CurrentProject.Connection
Set rs = New ADODB.Recordset

rs.Open SQLString, Conn, adOpenKeyset, adLockOptimistic

If Not (rs.EOF And rs.BOF) Then

Me.RecordSource = SQLString

Me.WhichRecord = Me.Recordset.Bookmark
Me.HowManyRecords = Me.Recordset.RecordCount

Else

MsgBox "No records match the criteria specified"

End If


Philipp said:
I was having issues with my form not showing the correct number of records so
I put in a MoveLast and MoveFirst cycle before I get the recordcount and it
[quoted text clipped - 5 lines]
Me.Recordset.MoveFirst
Application.Echo True

What about this?

Me.Painting = False
Me.Recordset.MoveLast
Me.Recordset.MoveFirst
Me.Painting = True

But nevertheless I agree with Sylvain. - There may be something wrong
with your approach in general.

Cheers
Phil
 
Possible answer: the fetching of records are asynchronous and is not
finished when you execute the statement « Me.HowManyRecords =
Me.Recordset.RecordCount ». You should use a timer and/or poke the state of
the Recordset and wait until it has finished doing its job.

Instead of doing a second requery, you could also use the recordset rs as
the source of the form. See http://support.microsoft.com/?kbid=281998 for
more informatin.
--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC


Jeff via AccessMonster.com said:
My recordset is less than 10,000. For whatever reason it doesn't return
then
correct RecordCount even though the new Recordset is correct. The reason I
need the correct RecordCount is that I have a custom navigation bar and I
re-
populate WhichRecord and HowManyRecords when a filter( new RecordSource )
is
applied. Here's the orginial code:

Dim Dealer As String
Dim SQLString As String

Dim rs As New ADODB.Recordset
Dim Conn As ADODB.Connection

Me.Requery

Dealer = InputBox("Please enter the Dealer Name", "Search", "")

SQLString = "EXEC dbo.SearchDealer " & Dealer

Set Conn = CurrentProject.Connection
Set rs = New ADODB.Recordset

rs.Open SQLString, Conn, adOpenKeyset, adLockOptimistic

If Not (rs.EOF And rs.BOF) Then

Me.RecordSource = SQLString

Me.WhichRecord = Me.Recordset.Bookmark
Me.HowManyRecords = Me.Recordset.RecordCount

Else

MsgBox "No records match the criteria specified"

End If


Philipp said:
I was having issues with my form not showing the correct number of
records so
I put in a MoveLast and MoveFirst cycle before I get the recordcount and
it
[quoted text clipped - 5 lines]
Me.Recordset.MoveFirst
Application.Echo True

What about this?

Me.Painting = False
Me.Recordset.MoveLast
Me.Recordset.MoveFirst
Me.Painting = True

But nevertheless I agree with Sylvain. - There may be something wrong
with your approach in general.

Cheers
Phil
 
Not in front of access, so I can't be sure, but ...

Have you tried using RecordsetClone?

Me.RecordsetClone.MoveFirst/Last
Me.Recordset = Me.RecordsetClone?

I know it is what I use for searching/etc and dealing with bookmarks.
Might help.

- Andrew
 
Back
Top