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

Access Reports

Status
Not open for further replies.

bmoyer23

MIS
Dec 5, 2001
46
US
How do I open an Access report in VB?
 
Try something like this


Public mcnn As ADODB.Connection
Private dbs As ADODB.Recordset

Set mcnn = New ADODB.Connection
mcnn.ConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = \\locationofdatabase\nameofdb.mdb"
mcnn.Open
Set dbs = New ADODB.Recordset
dbs.CursorType = adOpenKeyset
dbs.LockType = adLockOptimistic
dbs.Source = "SELECT * FROM (nameofreport)"
Set dbs.ActiveConnection = mcnn
dbs.Open
whatever you want to do with it
dbs.close
____
Joe
 
Set a reference to the MS Access Object Library

Dim DB As Access.Application

Set DB = New Access.Application

DB.OpenCurrentDatabase "C:\myDB.MDB"

DB.DoCmd.OpenReport "myReport", acViewPreview

Please Note: You will not be able to do this if Access is not installed on the same machine...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top