Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Location
    LONDON
    Posts
    238

    Unanswered: How to switch between form/datasheet view at run time

    Hi

    I am trying to write some VBA that will switch a sub form between a Form and Datasheet view.

    You can use the DefaultView proeprty of a form to change what view the form is opened in. You can also use the DoCmd.RunCommand acCmdFormView (for example) on the form that has the focus to change the forms view to a Form view whilst the form is running. This is fine if you have a button on the form, but if the form is in datasheet view, you have no button!

    Is there any VBA code that I can use on a parent form that can be used to switch the sub-form between form/datasheet?

    Regards
    Justin

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Re: How to switch between form/datasheet view at run time

    Originally posted by justin_tighe
    Hi

    I am trying to write some VBA that will switch a sub form between a Form and Datasheet view.

    You can use the DefaultView proeprty of a form to change what view the form is opened in. You can also use the DoCmd.RunCommand acCmdFormView (for example) on the form that has the focus to change the forms view to a Form view whilst the form is running. This is fine if you have a button on the form, but if the form is in datasheet view, you have no button!

    Is there any VBA code that I can use on a parent form that can be used to switch the sub-form between form/datasheet?

    Regards
    Justin
    Justin,

    The only thing that I can think you could do is set theDefaultView of the form and try a Refresh ... It might/might not work ...

  3. #3
    Join Date
    Jan 2004
    Location
    Jersey, UK
    Posts
    108
    Can't think of a way to do it but can suggest a work-around. Create another subform and interchange the visible properties of each form when the button on the parent form is clicked.

    Does that help?


    Regards - Andy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •