Hi,
In my program I use an Access(2003) Database. I've made some reports in it which the user can open within my program when a button is clicked. When I open the reports I need to fill in some parameter values. Now I want to open the reports and automatically fill the parameters so I don't get these questions popped up to fill them.
Anyone any ideas how to do this?
This is the code I have until now:
I use this reference:
Microsoft Access 11.0 Object Library
As imports I have this:
Imports Microsoft.Office.Interop.Access
Private Sub btnPrintReport_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintReport.Click
'het gekozen rapport openen als preview waarna het kan worden uitgeprint
Dim rapport As String
Dim Accessapp As New Microsoft.Office.Interop.Access.Application()
rapport = ComboBox1.Text
If rapport <> "" Then
Accessapp.OpenCurrentDatabase(DatabaseDir)
Accessapp.DoCmd.OpenReport(rapport, Microsoft.Office.Interop.Access.AcView.acViewPreview)
Accessapp.Visible = True
End If
Accessapp = Nothing
End Sub
And another question:
Before opening the report I open the database. When I do this I get a security warning about opening the database where I can choose out of 3 options (open,cancel,more info). Is it possible to automatically select the "open" option so I don't have to make a choice each time?
This warning is displayed because I have macro security on medium level and I don't want to change this.
In my program I use an Access(2003) Database. I've made some reports in it which the user can open within my program when a button is clicked. When I open the reports I need to fill in some parameter values. Now I want to open the reports and automatically fill the parameters so I don't get these questions popped up to fill them.
Anyone any ideas how to do this?
This is the code I have until now:
I use this reference:
Microsoft Access 11.0 Object Library
As imports I have this:
Imports Microsoft.Office.Interop.Access
Private Sub btnPrintReport_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintReport.Click
'het gekozen rapport openen als preview waarna het kan worden uitgeprint
Dim rapport As String
Dim Accessapp As New Microsoft.Office.Interop.Access.Application()
rapport = ComboBox1.Text
If rapport <> "" Then
Accessapp.OpenCurrentDatabase(DatabaseDir)
Accessapp.DoCmd.OpenReport(rapport, Microsoft.Office.Interop.Access.AcView.acViewPreview)
Accessapp.Visible = True
End If
Accessapp = Nothing
End Sub
And another question:
Before opening the report I open the database. When I do this I get a security warning about opening the database where I can choose out of 3 options (open,cancel,more info). Is it possible to automatically select the "open" option so I don't have to make a choice each time?
This warning is displayed because I have macro security on medium level and I don't want to change this.