Question : MS Access 2003 Toggling a Subform from Datasheet to Form view

I have a MS access 2003 main and sub form and I want to toggle the form from a datasheet fiew to a form view using a button on the page header of the main form.  The vba code behind the after update event of the button is :
      Forms![F-WrkOrdReqMain]![WorkOrderEntry]!RequestDate.SetFocus
     DoCmd.RunCommand acCmdSubformFormView

What additional code do I need so that the same toggle button can be clicked again and now display the Datasheet view.

LAD

Answer : MS Access 2003 Toggling a Subform from Datasheet to Form view

If you want a simple toggle, there's no need for any 'If' statement. This toggles the status to/from the datasheet view:

DoCmd.RunCommand acCmdSubformDatasheet
 
Random Solutions  
 
programming4us programming4us