Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205

    Unanswered: Exporting a report from a differnent dB

    Hello,

    If I have two databases, A.mdb and B.mdb, is it possible for me to open a report in A.mdb from B.mdb and export it in HTML format?

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    One way to do it is to create a Module in A.mdb that opens the report. Then in B.mdb at a reference to A.mdb. Then in B.mdb call the procedure in A.mdb.

    I am not sure how you would export it in HTML format though.

  3. #3
    Join Date
    Jan 2006
    Posts
    8

    for outputting to HTML can you use

    a macro and use Output. This will transfer a report into several different formats including html.

    Another longer way that I use is link the tables and then create the report in the database that you are wanting.

  4. #4
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    Quote Originally Posted by MasterShake
    a macro and use Output. This will transfer a report into several different formats including html.

    Another longer way that I use is link the tables and then create the report in the database that you are wanting.





    got it


    Function OpenRemoteReport(strDatabasePath As String, strMDB As String, _
    strReport As String, strExportPath As String, strExportFileName As String)

    Dim objAccess As Access.Application
    Dim lngRet As Long

    On Error GoTo errHandler

    'If IsMissing(intView) Then intView = acViewPreview

    If Len(strMDB) > 0 Then
    Set objAccess = New Access.Application
    With objAccess
    .Visible = False
    .DoCmd.Minimize
    .OpenCurrentDatabase strDatabasePath & strMDB
    .DoCmd.OutputTo acOutputReport, strReport, acFormatHTML, strExportPath & strExportFileName
    .CloseCurrentDatabase
    End With
    End If

    OpenRemoteReport_Exit:
    On Error Resume Next
    objAccess.Quit
    Set objAccess = Nothing
    Exit Function

    errHandler:
    Select Case Err.Number
    Case 7866:
    'mdb is already exclusively opened
    MsgBox "The database you specified " & vbCrLf & strMDB & _
    vbCrLf & "is currently open in exclusive mode. " & vbCrLf _
    & vbCrLf & "Please reopen in shared mode and try again", _
    vbExclamation + vbOKOnly, "Could not open database."
    Case 2103:
    'form doesn't exist
    MsgBox "The report '" & strReport & _
    "' doesn't exist in the Database " _
    & vbCrLf & strMDB, _
    vbExclamation + vbOKOnly, "report not found"
    Case Else:
    MsgBox "Error#: " & Err.Number & vbCrLf & Err.Description, _
    vbCritical + vbOKOnly, "Runtime error"
    End Select
    Resume OpenRemoteReport_Exit
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •