Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fill parameters and open access report

Status
Not open for further replies.

sbdproj

Programmer
Sep 22, 2003
22
NL
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top