maandag 18 juli 2011

ms access VBA expands subform on current

This is a workaround to expand subdatasheet when a record on the main
datasheet is clicked (selected on current)

Me.SubdatasheetExpanded = False
Me!frmSub1.SetFocus 'subdatasheet name

' on current even of the main datasheet
Private Sub Form_Current()
'Select current Record in the MainForm
DoCmd.RunCommand acCmdSelectRecord

'Hold SHIFT and CTRL, then press the DOWN Arrow to Expand all SubDatasheets
SendKeys "+^({DOWN})"

'Hold SHIFT and CTRL, then press the UP Arrow to Collapse all SubDatasheets
SendKeys "+^({UP})"

End Sub

test post