从Visual Basic预览MS Access报表

时间:2016-09-28 09:17:56

标签: vb.net ms-access

我有一个连接到MS Access 2010数据库的Visual Basic 2013程序。程序计算并将值写入DB后,我需要打印Access DB中的报告。

我现在的代码如下:

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

    If (ComboBox1.SelectedIndex = -1) Then

        MessageBox.Show("Please Select an Institute")


    Else



        Dim MSA As New Microsoft.Office.Interop.Access.Application

        MSA.Application.Visible = False 

        MSA.OpenCurrentDatabase(fName, False)


        Dim strFilter As String = Nothing

        strFilter = "[Institute] =  '" & ComboBox1.SelectedItem & "'"




        MSA.Application.DoCmd.OpenReport("Institute Wise Course Report sdate", AcView.acViewPreview, "", strFilter)

        MSA.Application.CloseCurrentDatabase()


    End If
End Sub

但问题是报告没有预览,请帮助任何人。

0 个答案:

没有答案