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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing parameters from VB to an Access DB

Status
Not open for further replies.

Giblets

Programmer
Feb 19, 2003
6
GB
Hello there,I'm having some trouble at the moment trying to pass parameters from vb to access, what I want to do is bring up an access report in vb regarding a particular customer, does anyone know how to pass the parameter from vb to access to allow me to do this?thanks for your time..
 
Set a reference to the access object and then:

Private AppAccess As New Access.Application

' Set Database
straccess = App.Path & "\AccessFile.mdb"

' Open Database
AppAccess.OpenCurrentDatabase straccess

' Database Commands to Print Reports
With AppAccess
.DoCmd.OpenReport "Local_single", acViewNormal
End With

Within appaccess you have access to all MS Access commands.
 
Try This. Set a reference to Microsoft Access.

Dim acApp As Access.Application
Dim DB_PATH As String

DB_PATH = DatabasePath 'Your Database Path

Set acApp = New Access.Application

acApp.OpenCurrentDatabase DB_PATH, False

acApp.DoCmd.OpenReport ReportName, acViewPreview, , customer = "Your Customer"

Hope it helps
 
Sorry forgot to mention that you just need to have the access report set up to accept whatever parameters you need
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top