Results 1 to 10 of 10

Thread: datsheet view

  1. #1
    New Lounger
    Join Date
    Feb 2001
    Location
    Minnesota
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    datsheet view

    I have some forms set-up to be datasheet view only. If I open them from the database window they open in datasheet view but if I open them from a button or switchboard they open in form view -- how can I get them to open in datasheet view from a switchboard or menu?

  2. #2
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: datsheet view

    Behind the OnClick Event of the button
    <hr> DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria, acFormAdd<hr>
    The acFormDS sets view to Data Sheet.
    <img src=/S/smile.gif border=0 width=15 height=15>

  3. #3
    New Lounger
    Join Date
    Feb 2001
    Location
    Minnesota
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: datsheet view

    This works for a button but how about from a menu or switchboard.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: datsheet view

    Just create a function that opens the form in datasheet view and then use the RunCode option in the switchboard wizard to get your form to open that way. The default View argument in DoCmd.OpenForm is acNormal, which is overriding the form's own settings.
    Charlotte

  5. #5
    New Lounger
    Join Date
    Feb 2001
    Location
    Minnesota
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: datsheet view

    this sounds easy but I am just learning VBA and have failed in my efforts.

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: datsheet view

    <pre>Public Function OpenRept()
    DoCmd.OpenForm strReptName, acFormDS
    End Function</pre>


    Where strReptName should be replaced with the actual name of the report.
    Charlotte

  7. #7
    New Lounger
    Join Date
    Feb 2001
    Location
    Minnesota
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: datsheet view

    Thank you for your help. It looks like I am over my head. I don't know how to do a "public function" maybe I better stick with a button and a macro.

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: datsheet view

    Create a new module, paste the public function into it and then use it from anywhere in the application. You can even call it from a macro if it makes you happy. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Charlotte

  9. #9
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: datsheet view

    Dear Charlotte
    If you changed the code slightly:
    Public Function OpenRept(strReptName as string)
    DoCmd.OpenForm strReptName, acFormDS
    End Function
    Wouldn

  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: datsheet view

    Unquestionably. I wouldn't hard code the value into a public function myself, but for someone who is unfamiliar with VBA, it offered a simple way to do what he was trying to do. Passing arguments can be very confusing to someone just learning how to program VBA.
    Charlotte

Posting Permissions

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