Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export report to ONE SINGLE html file?

When I use the Export to html function with Report, Access generate multiple pages of html (each page has about 30 lines or so of data).

How can I force Access to generate ONE SINGLE html file for the whole report? Thanks.

like image 397
user776676 Avatar asked Jul 23 '11 01:07

user776676


3 Answers

I created a function that may be helpful for others. It takes the a file path and then follows the links until the document is done. You need to export the report to an html file and then use that path in this function. I use it for creating a message for Outlook. This requires a reference to the Windows Script Host Object Model

Public Function fReadFile(strFile As String) As String
On Error GoTo ErrHandler

Dim FSO As FileSystemObject
Dim tsInput As TextStream
Dim strLine, strMessage As String
Dim strNextFile As String
Dim blnEnd As Boolean

Do While Not blnEnd
    Set FSO = New FileSystemObject
    Set tsInput = FSO.OpenTextFile(strFile, 1)
    Do While Not tsInput.AtEndOfStream
        strLine = tsInput.ReadLine
        If InStr(1, strLine, ">First<", vbTextCompare) > 0 And InStr(1, strLine, ">Previous<", vbTextCompare) > 0 And InStr(1, strLine, ">Next<", vbTextCompare) > 0 And InStr(1, strLine, ">Last<", vbTextCompare) > 0 Then
            Debug.Print strLine
            strNextFile = Mid(strLine, InStr(1, strLine, ">Previous</A> <A HREF=", vbTextCompare) + 23, InStr(1, strLine, """>Next<", vbTextCompare) - (InStr(1, strLine, ">Previous</A> <A HREF=", vbTextCompare) + 23))
            rem put the directory back in the file name
            strNextFile = IIf(strNextFile <> "#", Mid(strFile, 1, (InStrRev(strFile, "\"))) & strNextFile, strFile)
            blnEnd = (strNextFile = strFile)
        Else
            strMessage = strMessage & strLine
        End If
    Loop
    tsInput.Close
    Set FSO = Nothing
    strFile = strNextFile
Loop
fReadFile = strMessage
Exit Function
ErrHandler:
    Debug.Print Err.Description & " " & "fReadFile"
    Resume Next
End Function
like image 95
HelloW Avatar answered Oct 31 '22 19:10

HelloW


well it's kind of a funny workaround but you could export as an .rtf, then open in word and save as .htm. voila!

like image 35
vicki Avatar answered Oct 31 '22 21:10

vicki


Can't be done. Paper size has to be set based on printer driver. Access does not allow User Defined paper size even though this option exists in Page Setup.

like image 42
user776676 Avatar answered Oct 31 '22 20:10

user776676