How to export data in Ms access runtime

Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc used Ask the Experts™
on
Sorry again people there!

I'm now struggling to to put the print view back and be able to close the reports , I'm trying to use the two codes below:

<group id="grpPrint" label="Print" visible="true">
                    <button id="PrntRpt" size="large" label="Print" imageMso="PrintDialogAccess" onAction="=PrintDialog()"/>
                </group>
 
                <group id="grpClgrpRprt2" label="Close">
                     <button id="PPrClose"  label="Close" imageMso="PrintPreviewClose" size="large" onAction="OnCloseReport"/>
                </group>

Open in new window


The reasons why I want to use this method is because Ms Access application does allow users to export report to excel if the USER DOES NOT HAVE full version Ms access , this happen for those using runtime

The export function is working well now runtime but the two are give an error as MACROS FUNCTION does not exist.

Regards

Chris

print-view.png
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Senior Developer
Commented:
I have to ask: why don't you post a concise and complete example? You're long enough here to know that we need this to give you better advice..

But when I need to guess, the problem is your =PrintDialog(). I prefer the single ribbon calling approach and handle every thing in code:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="RibbonOnLoad">
    <ribbon>
        <tabs>
            <tab id="UNIQUE_TAB_ID" label="TAB LABEL">
                  <group id="grpPrint" label="Print" visible="true">
                    <button id="PrntRpt" size="large" label="Print" imageMso="PrintDialogAccess" onAction="RibbonOnAction"/>
                </group>

                <group id="grpClgrpRprt2" label="Close">
                     <button id="PPrClose"  label="Close" imageMso="PrintPreviewClose" size="large" onAction="RibbonOnAction"/>
                </group>
            </tab>
        </tabs>
        <contextualTabs>
            <tabSet idMso="TabSetFormDatasheet" visible="false" />
        </contextualTabs>
    </ribbon>
</customUI>

Open in new window

With your ribbon handler module as

Option Compare Database
Option Explicit

Private m_Ribbon As IRibbonUI

Public Sub RibbonOnAction(AControl As IRibbonControl)

  On Local Error Resume Next

  Select Case AControl.ID
    Case Is = "PrntRpt"
        PrintDialog
    Case Is = "PPrClose"
        OnCloseReport
    ' A Case branch for every control in your ribbon.
  End Select

End Sub

Public Sub RibbonOnLoad(ARibbon As IRibbonUI)

  On Local Error Resume Next

  Set m_Ribbon = ARibbon
  m_Ribbon.ActivateTab "YourMainTab"

End Sub

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial