Results 1 to 6 of 6
  1. #1
    utku is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2019
    Posts
    6

    Access Runtime Version Sub Form Print, Print Preview Issue

    Hello,
    I have a database with Access 2016 which frontend and backend splitted. I've put a print button inside a form which has a function to print a subform.
    While I try to use this function from front end, it's working on .accdb and .accde versions of form, but when I try to use print function from access runtime version I'm getting below errors.
    I'have tried to run by vba code and access macros and getting these errors still, is there any way to print forms from access runtime version?
    Subform name : "frmDailySummaryLossSpreadsheet"


    VBA Code:

    Code:
    Private Sub cmdprint_Click()
    
    
    Dim stDocName As String
    Dim MyForm As Form
    
    On Error GoTo Err_SomeName
    
        Application.Echo False
    
        stDocName = "frmDailySummaryLossSpreadsheet"
        DoCmd.SelectObject acForm, stDocName, True
    
        DoCmd.PrintOut acSelection
    If Not SysCmd(acSysCmdRuntime) Then
    
        DoCmd.NavigateTo "acNavigationCategoryObjectType"
        DoCmd.RunCommand acCmdWindowHide
    End If
        
    
        'DoCmd.SelectObject acForm, MyForm.name, False
        Application.Echo True
       
    'error handler
    Exit_SomeName:
        Application.Echo True
        Exit Sub
    
    Err_SomeName:
        Select Case Err.Number
          Case 9999                        ' Whatever number you anticipate.
              Resume Next                  ' Use this to just ignore the line.
          Case 999
              Resume Exit_SomeName         ' Use this to give up on the proc.
          Case Else                        ' Any unexpected error.
              Call LogError(Err.Number, Err.Description, "frmDailySummary_cmdprint_Click()")
              Resume Exit_SomeName
          End Select
    End Sub
    
    

    Attached Thumbnails Attached Thumbnails errorprint.PNG   errorprintpreview.PNG   Capture11.PNG  
    Last edited by utku; 09-13-2019 at 05:56 AM.

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    when you paste lengthy code into your post, please use the code tags to preserve indentation (highlight pasted code and click on the # button). You are more likely to get a response if users can read your code.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    the line that looks wrong to me is

    DoCmd.SelectObject acForm, stDocName, True

    see this link
    https://docs.microsoft.com/en-us/office/vba/api/access.docmd.selectobject

    the true requires a navigation pane to be available - runtime does not have a navigation pane

  4. #4
    utku is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2019
    Posts
    6
    Hi Ajax,
    Thanks for your reply, I've change code section in my post according to your advice.
    You are right there is an issue about this function SelectObject for runtime version, this is working for accdb & accde versions so my code was like that.
    I've tried to change code last option to false as below, but I've got another error as below picture (the object "subform" isn't open

    DoCmd.SelectObject acForm, stDocName, False

    Attachment 39723

    For printout any subform in Access, I think first that form needs to be selected by activating navigation pane and this is not possible in runtime version

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    just use docmd.open acform "formName"

    depending on requirements you may need to complete some of the other parameters - google to find out more

  6. #6
    utku is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2019
    Posts
    6
    Thanks, thats Ok for me. I've solved that way the issue.

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

Similar Threads

  1. Replies: 5
    Last Post: 08-06-2015, 03:26 PM
  2. Replies: 1
    Last Post: 02-21-2015, 11:35 PM
  3. Replies: 5
    Last Post: 07-29-2014, 01:05 PM
  4. Replies: 6
    Last Post: 03-01-2014, 07:07 AM
  5. Runtime Print Preview Toolbar on reports
    By Ruegen in forum Access
    Replies: 7
    Last Post: 10-08-2013, 08:15 PM

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