Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Access Tables + Relationships _ How Do I Access Table Visualizations Options In Vba?

Posted by: javert Aug 27 2019, 08:24 AM

These days I prefer to work with dark themes so I'm implementing them everywhere. Reversing colors for the forms and their controls was easy with a sub, but tables still display a fully white datasheet. The toolbar does have some buttons for text formating including the colors, but changes are only saved for the table where they were implemented, so I would have to do that manually for each table on the database. Is there a way to do that with VBA? In which object is this information located? I guess it is the same one that saves options like column order and widths, but DAO.Tabledef doesn't seem to be the object to acess this information.

Posted by: cheekybuddha Aug 27 2019, 11:35 AM

Hi, you can do this if you use a datasheet form, but I don't think it works is you use the table directly:

CODE
Function fDatasheetDefaults( _
  frm As Form, _
  Optional CellsEffect As Integer = acEffectNormal, _
  Optional GridlinesBehavior As Integer = acGridlinesVert, _
  Optional GridlinesColor As Long = 7500402, _
  Optional BackColor As Long = 4144959, _
  Optional AlternateBackColor As Long = 5330263, _
  Optional FontName As String = "Segoe UI", _
  Optional ForeColor As Long = vbWhite, _
  Optional FontHeight As Integer = 10 _
) As Boolean

  With frm
    .DatasheetCellsEffect = CellsEffect
    .DatasheetGridlinesBehavior = GridlinesBehavior
    .DatasheetGridlinesColor = GridlinesColor
    .DatasheetBackColor = BackColor
    .DatasheetAlternateBackColor = AlternateBackColor
    .DatasheetFontName = FontName
    .DatasheetForeColor = ForeColor
    .DatasheetFontHeight = FontHeight
  End With
  fDatasheetDefaults = (Err = 0)

End Function


Then in Form_Load():
CODE
  Call fDatasheetDefaults(Me)


hth,

d