Results 1 to 9 of 9
  1. #1
    JackieEVSC is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    70

    Problem showing/hiding toolbars

    Simple problem for someone who knows what they are doing, but I'm at a loss. I need the toolbar/ribbon to show only on reports, so that they can print, but I do not want ribbons on any of the forms.




    I thought I could accomplish this with the "DoCmd.ShowToolbar "Ribbon", acToolbarYes" in onopen on the report to show the toolbar. That worked, but when I closed the report, the toolbar was on the form that called it, despite that form being opened with "DoCmd.ShowToolbar "Ribbon", acToolbarNo" in the onclose property of the report.


    I tried using the code under onload/unload rather than open/close for the report/form, but I don't get a toolbar on the report.


    I have tried every combination I can think of and I can't get the reports to open with a toolbar (always in print preview) and not have the toolbar on any of the forms.


    I am lost. Can someone please show me where I'm going wrong? Thanks.
    __________________________________________________


    The (latest) code I'm using on the onload for the form is:\


    Private Sub Form_Load()
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    If OpenArgs = "SchlList" Then
    TabCtl0.Value = SchlList.PageIndex
    End If
    If OpenArgs = "StudNone" Then
    TabCtl0.Value = StudNone.PageIndex
    End If
    If OpenArgs = "Resources" Then
    TabCtl0.Value = Resources.PageIndex
    End If
    End Sub


    __________________________________________________


    The (latest) code for the onload for the report is:


    Private Sub Report_Load()
    DoCmd.ShowToolbar "Ribbon", acToolbarYes
    DoCmd.Close acForm, "frm_Reports"
    End Sub


    __________________________________________________


    The (latest) code for the unload is:


    Private Sub Report_Unload(Cancel As Integer)
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    DoCmd.OpenForm "frm_Reports", View:=acNormal, OpenArgs:="SchlList"
    End Sub
    Last edited by JackieEVSC; 09-23-2016 at 09:09 AM.

  2. #2
    JackieEVSC is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    70
    Anyone have any nuggets of wisdom they can give me on this?

  3. #3
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,463
    I think you would need to create your own Menu, Tool bar or custom ribbon. There are places to set these in the properties of a report and form in the Other tab.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I don't bother with ribbon control much - don't find the defaults to be a problem. However, since you don't seem to be making a whole lot of headway here, I'll make a couple of suggestions.
    First, I'd do all form/report property coding in the open event instead of the load event, which comes after the open event. The way I see it is, why not 'set up' the form/report before I try to load data, which may or may not conflict with the object properties I'm trying to set.
    Second, seems you were close, but Access decides you want the ribbon on your form after you caused it to display on the report. So reset the ribbon property on the form's Activate event. Since this issue would likely propagate through all your forms, I'd make this a function if it does what you want. Pass the form name to the function which you would create in a standard module.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    JackieEVSC is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    70
    Micron,

    I'll give that a try. Thank you so much!

  6. #6
    JackieEVSC is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    70
    Micron,

    That worked ... thank you very much!

  7. #7
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Glad I could help with something I know not much about.

  8. #8
    JackieEVSC is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Oct 2011
    Posts
    70
    I've never had any VBA training, so coding is quite difficult for me! I am very grateful for this forum. The people here have helped me so many times. I've posted on other forums and have never had the level of help that I get here! You all should get a very well-deserved pat on the back

  9. #9
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    On behalf of all other contributors, thanks for the accolades.
    What you said is exactly the reason I joined - I was very grateful for the help I got when I needed it and I've been trying to return the favour ever since.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Hiding/Disabling Toolbars and Editing Options
    By Torinjr in forum Security
    Replies: 4
    Last Post: 05-05-2015, 07:49 PM
  2. Problem with hiding Ribbon & Navigation Code
    By Greyhound Friend in forum Programming
    Replies: 9
    Last Post: 03-31-2014, 09:26 AM
  3. Hiding/Showing a Group of Controls
    By EddieN1 in forum Reports
    Replies: 6
    Last Post: 01-25-2014, 04:16 PM
  4. Form events and showing/hiding controls
    By Monterey_Manzer in forum Forms
    Replies: 2
    Last Post: 03-26-2013, 03:01 PM
  5. Showing/Hiding Navigation Buttons in VBA or Macro
    By chris.williams in forum Forms
    Replies: 3
    Last Post: 11-15-2011, 10:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums