Search code examples
ms-access-2007

MS Access 2007 Continuous Form Alternate Back Colour Screen Corruption


There should be a simple solution to this but I can't find one:

I have a continuous form with all of the controls Enabled and Locked with transparent background and frames. the Form:Detail section has an Alternate Back Colour set.

The form displays transactions for a bank account selected via a combo box in the form header. When the bank account is changed the new account's transactions are displayed.

However, if the first on-screen row displayed for the new account isn't the same colour as that for the previous account then all of the controls retain the background colour of the previously displayed row. The same screen corruption occurs on Requery or if control goes to a particular row.

Hopefully the picture below will clarify:

Example of Alternate Back Colour problem

I've tried all sorts of things but nothing seems to solve this. The last resort is removing the alternate back colour but I really don't want to do that. Any help in resolving this would be greatly appreciated.


Solution

  • Despite having tried to put this out of my mind and get on with functional stuff, it has been niggling away constantly. After a great deal of searching and generally getting distracted, I've found a really simple solution ( at https://access-programmers.co.uk/forums/showthread.php?t=268390):

    When I change accounts or go to a record, it is simply a matter of bracketing the record operation in an 'Echo False', 'Echo True' pair. So, for example:

        If RecordsetClone.RecordCount > 0 Then
            Me.RecordsetClone.MoveLast
            If Me.RecordsetClone.RecordCount > wRowNum Then
                wRecordNo = Me.RecordsetClone.RecordCount - wRowNum
            Else
                wRecordNo = Me.RecordsetClone.RecordCount
            End If
            Echo False
            DoCmd.GoToRecord , , acGoTo, wRecordNo
            Echo True
        End If
    

    or:

        Set rs = Me.Recordset.Clone
        rs.FindFirst "WkACT_ID = " & Nz(wCurrentRecord, 0)
        If Not rs.EOF Then
            Echo False
            Me.Bookmark = rs.Bookmark
            Echo True
        End If
    

    Hoorah! Hopefully that will be helpful to somebody stuck with the same cosmetic, though infuriating, problem.