Results 1 to 9 of 9
  1. #1
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129

    VBA action on page tab click


    I am making up a demo of a database where I want to display a report with Notes/Guide adjacent to my form
    Of course I would close the current Page tab Guide and open the new page guide with each tab click
    Now although the tab Event procedures are displayed (only 5 events are there but On Click is one of them)
    I can get no event to occur. any clues anyone
    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    See post #4 in https://www.accessforums.net/forms/i...orm-36841.html

    What do you mean by 'close the current Page tab Guide and open the new page guide'?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    Sorry the Page Tab guide is the report I would "pop up" for each tab to give the viewer a "guide"
    as I say this is a DEMO of an existing database which is to give the viewer an idea of the DB without reading tedious help files
    I see in your other post
    "The tab page has a Click event but doesn't seem to do anything when I tested code nor does the tab control Click event. Annoying."
    yeh i'll say
    mmmm still thinking bout this one

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Consider:

    Private Sub TabCtl290_Change()
    Select Case Me.TabCtl290.Value
    Case 0
    'open this popup
    Case 1
    'open this popup
    Case 2
    'open this popup
    End Select
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    As you've found, the Page OnClick event doesn't fire when you click on the Tab of the Page, you have to click on the Page itself, which makes it pretty much useless. This is why June7 suggested using the OnChange event of the Tabbed Control.

    Also note, in June7's example, that the Page Index of a Tabbed Control is zero-based, so

    Case 0 refers to the first page, Case 1 refers to the second page, and so forth.

    Linq ;0)>

  6. #6
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    Sorry for the delay I have only just returned to this project.
    Yes that works, only closing each report looks like it could be a bit messy. I cannot see any way to specify close a specific object.
    Close of course closes the object that is currently in focus and if a tab has been click the form is in focus.
    I could in each Case open each report followed by Close except for the report i want to stay open
    Any other suggestions

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Not sure what the question is... maybe
    DoCmd.Close acReport, "ReportName"

    or wrtite code to go through and see if a particular report is open?

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Not sure I understand the issue, however, Close method can specify object.

    If CurrentProject.AllReports("reportname").IsLoaded Then DoCmd.Close acReport, "reportname", acSaveNo
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    libraccess's Avatar
    libraccess is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Napier New Zealand
    Posts
    129
    did i write my last post > don't know how you understood > i hardly do

    anyway solved thanks all - so i have 4 reports, below code is for report 3, so i close any of the others if they are open and i have the same code in the others (rpt number to suit)

    for Report A_guide3


    Private Sub Report_Open(Cancel As Integer)


    If CurrentProject.AllReports("A_guide1").IsLoaded Then
    DoCmd.Close acReport, "A_guide1", acSaveNo
    End If
    If CurrentProject.AllReports("A_guide2").IsLoaded Then
    DoCmd.Close acReport, "A_guide2", acSaveNo
    End If


    If CurrentProject.AllReports("A_guide4").IsLoaded Then
    DoCmd.Close acReport, "A_guide4", acSaveNo
    End If
    End Sub
    Thanks All

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

Similar Threads

  1. Replies: 1
    Last Post: 03-05-2013, 06:38 PM
  2. Replies: 1
    Last Post: 11-21-2012, 08:18 AM
  3. tab control - firing a page on-click event
    By Chuck55 in forum Programming
    Replies: 7
    Last Post: 05-01-2012, 09:57 AM
  4. Replies: 3
    Last Post: 08-07-2011, 09:22 PM
  5. Page break on report inserts empty page between
    By Galadrielle in forum Reports
    Replies: 0
    Last Post: 07-07-2010, 04:18 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