Code Examples

Change the Display of a Subform

acCmdSubformDatasheetView, acCmdSubformFormView  

This code was posted by the Access MVP Brendan Reymolds on the microsoft.public.Access newsgroup.

'***************** Code Start *******************
Private Sub Command1_Click() 

   Me.NameOfSubformControl.SetFocus 

   '1 = form view, 2 = datasheet view ... 
   If Me.NameOfSubformControl.Form.CurrentView = 1 Then 
     DoCmd.RunCommand acCmdSubformDatasheetView
   Else
     DoCmd.RunCommand acCmdSubformFormView
   End If 

End Sub
'****************** Code End ********************

© 1998 - 2011 Terry Wickenden TKW Design Site developed maintained and hosted by TKW Design. This site is best viewed at 1024 x 768. Optimised for Firefox.