Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Access Report and VB6

Ok guys, here is one I am battling with.
I can open access and get to the report via VB6 no problem. My problem is this:- I want to be able to now export the access report to a word document using code in vb6. I don't want to reinvent the wheel and redo the report using automation for ms word. that is just to much coding for my poor tired brain at the moment. so, can i export the report to ms word using vb6? if you can let me know how, i will be eternally gratefull and will include you in my epitaph!!

Comments

  • dokken2dokken2 Member Posts: 532
    : Ok guys, here is one I am battling with.
    : I can open access and get to the report via VB6 no problem. My
    : problem is this:- I want to be able to now export the access report
    : to a word document using code in vb6. I don't want to reinvent the
    : wheel and redo the report using automation for ms word. that is just
    : to much coding for my poor tired brain at the moment. so, can i
    : export the report to ms word using vb6? if you can let me know how,
    : i will be eternally gratefull and will include you in my epitaph!!
    :

    actually, automation allows you to easily output the report to word by using access' own Output method. this example keeps access hidden and doesn't start word-

    [code]
    'requires reference to Microsoft Access 10.0 Object Library
    Dim cPath As String
    Dim AccessApp As Access.Application

    Private Sub c1StartAccess_Click()
    'START ACCESS
    Set AccessApp = New Access.Application

    'AccessApp.Visible = True 'show access
    AccessApp.Visible = False 'hide access
    AccessApp.OpenCurrentDatabase cPath 'open mdb
    End Sub

    Private Sub c2OutputReport_Click()
    'OPEN A REPORT
    'AccessApp.DoCmd.OpenReport "report1", acViewPreview
    'OUTPUT REPORT TO WORD - START WORD
    'AccessApp.DoCmd.OutputTo acOutputReport, "Report1", acFormatRTF, "D:Report1.rtf", True
    'OUTPUT REPORT TO WORD - DONT START WORD
    AccessApp.DoCmd.OutputTo acOutputReport, "Report1", acFormatRTF, "D:Report1.rtf", False
    End Sub

    Private Sub c3CloseAccess_Click()
    On Error Resume Next
    'QUIT ACCESS
    AccessApp.CloseCurrentDatabase
    AccessApp.Quit
    Set AccessApp = Nothing
    End Sub

    Private Sub Form_Load()
    'PATH TO A SAMPLE ACCESS MDB FILE
    cPath = App.Path + "acc2000.mdb"
    End Sub
    [/code]
  • CarterLangleyCarterLangley Member Posts: 29
    : : Ok guys, here is one I am battling with.
    : : I can open access and get to the report via VB6 no problem. My
    : : problem is this:- I want to be able to now export the access report
    : : to a word document using code in vb6. I don't want to reinvent the
    : : wheel and redo the report using automation for ms word. that is just
    : : to much coding for my poor tired brain at the moment. so, can i
    : : export the report to ms word using vb6? if you can let me know how,
    : : i will be eternally gratefull and will include you in my epitaph!!
    : :
    :
    : actually, automation allows you to easily output the report to word
    : by using access' own Output method. this example keeps access
    : hidden and doesn't start word-
    :
    : [code]:
    : 'requires reference to Microsoft Access 10.0 Object Library
    : Dim cPath As String
    : Dim AccessApp As Access.Application
    :
    : Private Sub c1StartAccess_Click()
    : 'START ACCESS
    : Set AccessApp = New Access.Application
    :
    : 'AccessApp.Visible = True 'show access
    : AccessApp.Visible = False 'hide access
    : AccessApp.OpenCurrentDatabase cPath 'open mdb
    : End Sub
    :
    : Private Sub c2OutputReport_Click()
    : 'OPEN A REPORT
    : 'AccessApp.DoCmd.OpenReport "report1", acViewPreview
    : 'OUTPUT REPORT TO WORD - START WORD
    : 'AccessApp.DoCmd.OutputTo acOutputReport, "Report1", acFormatRTF, "D:Report1.rtf", True
    : 'OUTPUT REPORT TO WORD - DONT START WORD
    : AccessApp.DoCmd.OutputTo acOutputReport, "Report1", acFormatRTF, "D:Report1.rtf", False
    : End Sub
    :
    : Private Sub c3CloseAccess_Click()
    : On Error Resume Next
    : 'QUIT ACCESS
    : AccessApp.CloseCurrentDatabase
    : AccessApp.Quit
    : Set AccessApp = Nothing
    : End Sub
    :
    : Private Sub Form_Load()
    : 'PATH TO A SAMPLE ACCESS MDB FILE
    : cPath = App.Path + "acc2000.mdb"
    : End Sub
    : [/code]:


    you absolute genius!!!!!!!
Sign In or Register to comment.