locked
Gray background in subform row RRS feed

  • Question

  • I have a form/subform situation. The data in the subform is read only and merely displays where the record in the main form occurs in another related table. The first row in the subform always appears with a gray background (all except the primary key column), the second and subsequent rows do not. Why is this and how can I prevent it?

    Wednesday, June 12, 2013 5:56 PM

Answers

  • When I click on another row, that entire row gets the gray background (including the case # column) and the first row becomes normal. This is exactly what happens when viewing a table in datasheet view so I assume it's default behaviour. I tried disabling the record selectors but it made no difference.

    What you're seeing is standard datasheet behavior in Access 2007 and later.  The current row is highlighted by a gray background, except for the active cell.  If there is no active cell, then all cells in the row are so highlighted.

    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    Thursday, June 13, 2013 5:37 PM

All replies

  • Since instances of the Controls on the first row appear to be different from instances of the same Controls in other rows, I can only think of Conditional Formatting as a possible problem.

    In the design view of the Form being used as the SubForm, select one of the Controls (not the one bound to the PK Field) and check the Conditional Formatting of the selected Control to see if you have anything unexpected.


    Van Dinh

    Wednesday, June 12, 2013 6:29 PM
  • No conditional formatting. Seems like this is default behaviour for datasheet view. Don't know if it can be changed.
    Wednesday, June 12, 2013 8:58 PM
  • Ah... the graphic helps (I didn't see it on my last reply).

    Not sure but I think that looks like the whole row/record is selected except the Control bound to [Case #] is disabled???

    Try clicking the little grey rectangle (the Record Selector in Datasheet) in front of another row (on the left side of the Datasheet) and see if the first row becomes "normal" and the clicked now looks like the first row previously.


    Van Dinh


    • Edited by Van Dinh Thursday, June 13, 2013 4:37 AM
    Thursday, June 13, 2013 12:40 AM
  • When I click on another row, that entire row gets the gray background (including the case # column) and the first row becomes normal. This is exactly what happens when viewing a table in datasheet view so I assume it's default behaviour. I tried disabling the record selectors but it made no difference.
    Thursday, June 13, 2013 4:24 PM
  • OK... so we know that it is the effect of the record selection (except for the different behaviour of theControl bound to [Case #] - probably the effect of the ActiveControl).

    There bound to be some option settings for this behaviour (but I don't know yet).  However, I need to know a bit more about your set-up:

    1.  Which Access version are you using?

    2.  Which database file format are you using? MDB or ACCDB? Something else?

    3.  How do you set "The data in the subform is read only"?


    Van Dinh

    Thursday, June 13, 2013 4:43 PM
  • When I click on another row, that entire row gets the gray background (including the case # column) and the first row becomes normal. This is exactly what happens when viewing a table in datasheet view so I assume it's default behaviour. I tried disabling the record selectors but it made no difference.

    What you're seeing is standard datasheet behavior in Access 2007 and later.  The current row is highlighted by a gray background, except for the active cell.  If there is no active cell, then all cells in the row are so highlighted.

    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    Thursday, June 13, 2013 5:37 PM
  • Access 2010. MDB format. Made read-only by seting AllowAdditions, AllowDeletions, AllowEdits, DataEntry all to No.

    Also set Locked to True on the parent form control.
    Thursday, June 13, 2013 6:09 PM
  • AllTheGoodNamesWereTaken

    It looks to me that Dirk has provided the explanation of the gray background of the current row.


    Van Dinh

    Thursday, June 13, 2013 10:59 PM