Link to home
Start Free TrialLog in
Avatar of dttri
dttriFlag for Viet Nam

asked on

VB6 and Access 2002 problem.

 Hello experts!
  I'm using VB6 and Access 2002 for my database development. In my program, I want to display report and I think Access Report may solve the problem. I search experts-exchange and I find the code:

Public app As Application
Set app = New Access.Application
app.OpenCurrentDatabase "C:\db1.mdb"
app.DoCmd.Maximize
app.DoCmd.OpenReport "EmpReport", acViewPreview

  But nothing happen after I run this code, do you know how to fix this? And, I want the report will be displayed in my App, not in the Access window, how can I do this with VB6 and Access 2002? If at my user machine, only older Access version is installed, will my program run properly?

  Thank you.
Avatar of Mikal613
Mikal613
Flag of United States of America image

app.DoCmd.Maximize is VBA not vb6
@Mikal,
    Have a look at the code, the person is manipulating Access (via VBA) through VB6, or at least this was the attempt.

@dttri,
    Is your database located in the directory "C:\" with a name of "db1.mdb"?
    Do you have a Report named "EmpReport" in that database?

    As for making the Report open in VB6 and not Access, that's not possible, it has to use Access since it is an Access Report.  Have you considered just using a Data Report in VB6?  Or maybe even Crystal Reports?

-Anthony
Avatar of dttri

ASKER

>>Is your database located in the directory "C:\" with a name of "db1.mdb"?
Yes, it is.
>>Do you have a Report named "EmpReport" in that database?
Yes, it have.
Avatar of dttri

ASKER

 I also notice that, after run these commands, although Access or report don't appear, I see Access in the Task Manager (process tab). Do you have any suggestion?
  Thank you.
ASKER CERTIFIED SOLUTION
Avatar of ALaRiva
ALaRiva
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dttri

ASKER

 Thanks very much! The report appear!