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.
LVL 7
dttriAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mikal613Commented:
app.DoCmd.Maximize is VBA not vb6
0
ALaRivaCommented:
@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
0
dttriAuthor Commented:
>>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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

dttriAuthor Commented:
 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.
0
ALaRivaCommented:
ok, I don't have VB6 in front of me, but it looks like the problem is that you forgot to make the object visible.

It'll be something like this:
app.Visible = True

Put that after the line that opens the Report and you should be fine.

Give that a try and you should see the report come up.

-Anthony
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dttriAuthor Commented:
 Thanks very much! The report appear!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.