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

Viewing Access Reports in VB 2

Status
Not open for further replies.

RichMH

Programmer
Aug 13, 1999
6
0
0
GB
I don't have Crystal Reports, and Data Reports in VB is rubbish. Does anyone know if you can create reports in Access 97 and then call them from VB6? If so how....
 
I used this code to open a report from Visual Basic in Access. Hope this helps.<br>
<br>
Private Declare Function apiSetForegroundWindow Lib "user32" Alias "SetForegroundWindow" (ByVal hwnd As Long) As Long<br>
Private Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Long, ByVal ncmdshow As Long) As Long<br>
Private Const SW_MAXIMIZE = 3<br>
<br>
<br>
Public Sub CreateReport()<br>
Dim objAccess As New Access.Application<br>
<br>
Set objAccess = New Access.Application<br>
<br>
With objAccess<br>
<br>
.OpenCurrentDatabase ("{path of database}")<br>
<br>
.DoCmd.OpenReport rptName, 2<br>
<br>
.DoCmd.SelectObject 3, rptName <br>
.DoCmd.Maximize<br>
<br>
lngret = apiSetForegroundWindow(.hWndAccessApp)<br>
lngret = apiShowWindow(.hWndAccessApp, SW_MAXIMIZE)<br>
lngret = apiShowWindow(.hWndAccessApp, SW_MAXIMIZE)<br>
<br>
End With<br>
End sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top