Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 47
  1. #16
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    You've used code snippets from both the report view and print preview versions of my code.
    Recommend you decide which version you want and just use that section of code.
    If you use print preview, get rid of the print button on the report as it won't show and will not have any purpose.

    Make sure the report default view is the same as above.

    Check your report properties. I used popup=no, modal=yes.
    Finally, check what the report looks like when opened direct from the navigation pane.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  2. #17
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    I've make the adjustments you're recommended and changed the report properties to popup = no, modal = yes.

    I continue to get only the report's window bar as shown here:
    Click image for larger version. 

Name:	000.jpg 
Views:	24 
Size:	11.0 KB 
ID:	45138

    The code that opens the window:
    Code:
    Private Sub cmdPrint_Click()
    '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    '
    '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    strRptRecSrc = Me.RecordSource     'RecordSource for report changes as we change
    strRptFilter = Me.Filter
    strRptSort = SortColumn
    
    On Error GoTo Err_Handler
    
         'hide form & open report in report view
        DoCmd.Minimize
        DoCmd.OpenReport "rptDirectory", acViewReport, , , acDialog
        
    Exit_Handler:
        Exit Sub
    
    Err_Handler:
        strProc = "cmdReportView_Click"
        MsgBox "Error " & Err.Number & " in " & strProc & " procedure : " & Err.description
        Resume Exit_Handler
    End Sub
    And, the Open & Load code in the report's module:
    Code:
    Option Compare Database
    Option Explicit
    Dim strAppendage As String
    Dim strProc As String
    
    
    Private Sub Report_Open(Cancel As Integer)
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    '  strRptSort is a global variable that is set by frmRegistry and frmPrintOptions
    '  depending on conditions chosen by the user.  The OPEN code here simply adjusts
    '  the report title section in keeping with and the setting of the sort order.
    '*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    On Error GoTo Err_Handler
       
    Me.lblHeader.Caption = strRptTitle
    
    Select Case strRptSort
        Case "lblLastName"
            strAppendage = "Last Name"
            Me.OrderBy = "LastName"
        
        Case "lblFirstName"
            strAppendage = "First Name"
            Me.OrderBy = "FirstName"
        
        Case "lblUnit"
            strAppendage = "Apartment numbers"
            Me.OrderBy = "Unit"
        
        Case "lblExt"
            strAppendage = "Telephone Extensions"
        
        Case "lblCell"
            strAppendage = "Cell numbers"
            Me.OrderBy = "Cell"
        
        Case "lblLandLine"
            strAppendage = "Landline numbers"
            Me.OrderBy = "Landline"
        
        Case "lblEMA"
            strAppendage = "Email Addresses"
            Me.OrderBy = "EMA"
    End Select
    
    Me.RecordSource = strRptRecSrc
    Me.Filter = strRptFilter
    Me.FilterOn = True
    
    Me.OrderByOn = True
    Me.lblSortedBy.Caption = "Listing Sorted by " & strAppendage
    
    Exit_Handler:
        Exit Sub
    
    Err_Handler:
        strProc = "Report_Open"
        MsgBox "Error " & Err.Number & " in " & strProc & " procedure : " & Err.description
        Resume Exit_Handler
    
    End Sub
    
    Private Sub Report_Load()
    On Error GoTo Err_Handler
        
        'Show & maximize ribbon
        ShowRibbon
        If IsRibbonMinimized = True Then ToggleRibbonState
        ShowRibbon
        
    
    Exit_Handler:
        Exit Sub
    
    Err_Handler:
        strProc = "Report_Load"
        MsgBox "Error " & Err.Number & " in " & strProc & " procedure : " & Err.description
        Resume Exit_Handler
    End Sub

  3. #18
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    I'm confused.
    You are using report view.
    In that case why show the ribbon? The application interface is I believe still hidden.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #19
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    You are using report view.
    Yes, here's the code that opens the report:
    Code:
    Private Sub cmdPrint_Click()
    '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    '
    '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    
    Me.Visible = False
    
    On Error GoTo Err_Handler
    
         'hide form & open report in report view
        DoCmd.Minimize
        DoCmd.OpenReport "rptDirectory", acViewReport, , , acDialog
        
    Exit_Handler:
        Exit Sub
    
    Err_Handler:
        strProc = "cmdReportView_Click"
        MsgBox "Error " & Err.Number & " in " & strProc & " procedure : " & Err.description
        Resume Exit_Handler
    
    End Sub
    I beg ignorance relating to your question about the ribbon. I removed it from the Load event.

  5. #20
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    You have the line Me.Visible=False so the form is now hidden
    What is the point of the DoCmd.Minimize line?
    Try commenting that line out.

    You didn't respond to this earlier comment in post #16:
    Finally, check what the report looks like when opened direct from the navigation pane.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #21
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    You have the line Me.Visible=False so the form is now hidden
    Deleted

    What is the point of the DoCmd.Minimize line?
    Deleted (left over from copying your code where you were supporting both forms of the OpenReport)

    what the report looks like when opened direct from the navigation pane.
    Other than lacking availability of the RecordSource (?Name, etc), the report looks normal.

    The current state of the app is as shown with the following screenshot:
    Click image for larger version. 

Name:	001.jpg 
Views:	24 
Size:	85.7 KB 
ID:	45146

  7. #22
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Quote Originally Posted by GraeagleBill View Post
    Other than lacking availability of the RecordSource (?Name, etc), the report looks normal.
    I think that's your explanation. That was why I kept asking you to open it direct from the navigation pane.
    The issue is nothing to do with hiding the application window.

    You have an unbound report with no controls in report view so it shrinks to fit the completely empty report showing just the title bar and the grey scroll bar at the bottom
    If you had instead used print preview you would have seen a blank page.

    Create your report with the data source and all related controls in each section. It should then appear 'normal' size in report view
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #23
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    You have an unbound report with no controls in report view so it shrinks to fit the completely empty report showing just the title bar and the grey scroll bar at the bottom
    I think I have a timing issue relating to when the report "finds out" which RecordSource it's to use. The report IS bound, the default being QRegistry as you can see from this screenshot:
    Click image for larger version. 

Name:	002.jpg 
Views:	18 
Size:	133.7 KB 
ID:	45150


    The report Detail controls can populate from either QRegistry OR QGroupings and the answer to which to use isn't known until the report opens, the name of the RecordSource is found in a global variable when the report opens thustly:
    Code:
    Me.RecordSource = strRptRecSrc
    Me.Filter = strRptFilter
    Me.FilterOn = True
    
    Me.OrderByOn = True
    Me.lblSortedBy.Caption = "Listing Sorted by " & strAppendage
    If I comment out these lines and open the report from the navigation pane, letting the RecordSource default to QRegistry, the report displays properly as you expected and I thought I'd answered in #21. Anyway, the setting of the RecordSource is simply not taking effect as intended so it seems that's my only remaining issue. And YES, the Access window remains hidden when I open the report, though the positioning at screen 0,0 isn't going to be acceptable?

    At the time I coded the Open event, it seemed logical to set the RecordSource at the "earliest" opportunity, but is that my problem?

    Here's the code for the command button when the report is opened from the display of the Registry:

    Code:
    Private Sub cmdPrint_Click()
    '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    '
    '=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
    strRptRecSrc = Me.RecordSource     'RecordSource for report changes as we change
    strRptFilter = Me.Filter
    strRptSort = SortColumn
    
    On Error GoTo Err_Handler
    
    DoCmd.OpenReport "rptDirectory", acViewReport, , , acDialog
        
    Exit_Handler:
        Exit Sub
    
    Err_Handler:
        strProc = "cmdReportView_Click"
        MsgBox "Error " & Err.Number & " in " & strProc & " procedure : " & Err.description
        Resume Exit_Handler
    End Sub
    BTW, as you've undoubtedly already noticed, Reports has never been my forte' and I avoid them whenever I can.

  9. #24
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Suggest you upload a cut down version of your database as its taking too many posts on both sides and we don't seem to be much nearer a successful outcome.
    Does using print preview work any better?

    The position can easily be fixed. Try setting AutoCenter =Yes in the property sheet. Is that any better?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  10. #25
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    The position can easily be fixed. Try setting AutoCenter =Yes in the property sheet. Is that any better?
    Ouch! I thought I'd already tried that among all the other "shotgun" approaches with this caper........... ARGH! But yes, that puts the report where it belongs. Here's what I get if I code acViewPreview instead of acViewReport: Click image for larger version. 

Name:	003.jpg 
Views:	21 
Size:	6.5 KB 
ID:	45154

    I'm struggling trying to get the DB zip down to the 2MB Forum limit. How about I upload to Dropbox and post a link? (I've managed to get it down to 2.5MB, but that's "bare bones")

    https://www.dropbox.com/s/8npdmkozct71rc5/RDS.zip?dl=0

  11. #26
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    That's very odd. Check you also have Auto Resize=Yes and Fit To Page=Yes.
    If that doesn't fix it then please upload a cut down version of your dB.

    Better to post here so others can contribute ideas as well.
    Just make a copy of your dB, remove all unrelated items and most of the data, compact and zip.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  12. #27
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    That's very odd. Check you also have Auto Resize=Yes and Fit To Page=Yes.
    These two properties are set as you mention.

    Anyone that is interested can download the zip file at Dropbox, (post #25). It's as small as I could get it and still make it useful.

  13. #28
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    OK you win. I downloaded it from Dropbox.

    SOLVED:

    Tested it in both report view & print preview
    Changes made:
    1. As you are leaving your popup forms open, I changed the report to Popup=Yes as well so it is shown on top
    2. Changed UseDefaultPaperSize to Yes
    3. Slightly reduced the control widths so it fit on one page. However I recommend you either reduce font size or change to landscape view so the EMail column is fully displayed
    4. Disabled the PageHeaderSection_Format event as its slightly too large for the space available. Either reduce it slightly or omit (not sure its needed)
    If you change to landscape. you'll need to alter that anyway
    4. I also restored the #If VBA7 clause in modDatabaseWindow you had disabled so I could run it in 64-bit Access. It does no harm leaving it in place even if you only use 32-bit Access

    Zipped version of the modified FE ONLY attached. I'm not convinced I needed most of the items / data you included
    Next time, please save me some time. Just include what is actually needed AND tell me exactly what I need to click to replicate the issue

    P.S. Is this real data? If so, I will remove both screenshot & the attached file once you have downloaded it.

    EDIT: Removed screenshot as it showed live data. No point removing the attachment as that is the FE only with no data
    Attached Files Attached Files
    Last edited by isladogs; 05-05-2021 at 09:44 AM. Reason: Removed screenshot
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  14. #29
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    If you select "Resident Directory", then click on the "Print" command button at the bottom of the display and get the results you show in your screenshot, then it would appear there's some unexplained difference between your 32bit Access 2010 and my 32bit Access 2013, as I still get the empty report as shown in the screenshot posted in #21 when I run your RDS-Source-V7.0.accdb as extracted from the CR.zip you posted.

    You're right in your comments of Portrait versus Landscape given the width of the fields versus the font sizes used. I'll deal with that issue once I get the report to open correctly.

    Given your efforts to resolve my difficulty here have left me really puzzled with not being able to reproduce your apparent success.

  15. #30
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Hmm. Very odd. I think the problem is with your own code and is probably unrelated to hiding the application window

    Try opening the last version of the database with the Shift key to bypass the startup code
    1. Open frmRDS then click the top button to open frmRegistry & run the report. You get the 'minimized report'
    2. Open frmRegistry direct from the navigation pane then run the report. It should now display correctly. That may have been what I did before

    Anyway, I think I've fixed it as follows.
    Changed the code to open the report in print preview. It opened shrunken so I enlarged it to the required size, changed to design view and reset Auto Resize = No so it will keep that setting and saved the report.
    Reopened normally using frmRDS then frmRegistry & ran the report. It worked fine.
    Changed the code back to use Report View and repeated the above. It still worked perfectly

    Updated version 7.1 attached with those changes. Hopefully it will also work for you
    Attached Files Attached Files
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Page 2 of 4 FirstFirst 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 10
    Last Post: 12-05-2017, 01:14 AM
  2. Replies: 5
    Last Post: 10-29-2017, 06:46 AM
  3. Replies: 10
    Last Post: 05-26-2017, 02:38 AM
  4. Minimize form If access Window is restored
    By Lukael in forum Programming
    Replies: 2
    Last Post: 04-02-2016, 10:25 AM
  5. Minimize access window problem
    By McHammer in forum Forms
    Replies: 2
    Last Post: 04-24-2010, 05:14 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