Modifying reports with VB6

J

Jim Satterfield

I have a program written in VB6 with an mdb file backend on the server in
Access 2000 format. I
have reports that I create on my computer that has Access installed that I
need people on other computers to be able to print. The problem is the old
issue of Access resetting the paper size if it happens to run out of legal
paper. The code that I've seen and used to fix this problem depends on being
able to create an instance of the Access app. This of course does not work
on a PC that doesn't have Access installed. Is there a way to
programmatically do this from VB6 without the Access application? I haven't
been able to find one.
 
G

Guest

Because an Access report is an object within an Access application, it cannot
be executed without using access. If you don't have full Access, it is
possible, if you have it, to install a run time version of Access.
 
J

Jim Satterfield

What is the situation with licensing for the Access 2000 runtime? The actual
download page doesn't say anything. Another page that hasn't been updated
since 2004 says that you have to have the developer edition of Office to use
it. But other versions are free for use. Does anyone have any idea on this
issue?
 
G

Guest

Jim,
I am not absolutely clear on this issue. It is my understanding that the
runtime for 2007 is a free download. Prior to that, you had to purchase a
license, but it was bundled with another product. It used to be the
Developer's edition, but I am not even sure what it is now.
We use 2003 here and it is im Microsoft Office 2003 Access Developers
Extensions.
 
J

Jim Satterfield

I think it's with both the full developer's edition of Office 2000 and also
the developer's tools. If it does come with the latter package and I can
distribute it internally with my program then I'm set.
 
J

Jim Satterfield

I haven't found any documentation on the subject yet but I assume that
having the runtime available means that the same calls I make to Access
should work, like instantiating an application object, etc. If there are
special considerations where would I find documentation for it?
 
G

Guest

Yes, if you have the runtime, it includes the right to distribute. The only
issue you have to deal with is the right to distribute ActiveX controls. You
must have distribution rights for them from whomever provides them.
 
G

Guest

Probably in the KB articles on the MSDN web. If you are going to instantiate
an application object, the application will have to be installed on the
computer where the Access application lives.
 
J

Jim Satterfield

Here is the code that crashes in the app I'm working on right now if Access
isn't installed. Should it run on a PC that has the runtime installed?

Dim rpt As Report
Dim strDevModeExtra As String
Dim DevString As str_DEVMODE
Dim DM As type_DEVMODE
Dim appAccess As Application

Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase "N:\MktShare\marketdata.mdb", True

appAccess.DoCmd.OpenReport strName, acDesign 'Opens report in Design
view.

Set rpt = Reports(strName)

If Not IsNull(rpt.PrtDevMode) Then
strDevModeExtra = rpt.PrtDevMode
DevString.RGB = strDevModeExtra
LSet DM = DevString
DM.lngFields = DM.lngFields Or DM.intOrientation 'Initialize fields.
DM.intPaperSize = 5 'Legal size
DM.intOrientation = 2 'Landscape
LSet DevString = DM 'Update property.
Mid(strDevModeExtra, 1, 94) = DevString.RGB
rpt.PrtDevMode = strDevModeExtra
appAccess.DoCmd.Close acReport, strName, acSaveYes
appAccess.CloseCurrentDatabase
appAccess.Quit acExit
Set appAccess = Nothing
Else

End If
 
G

Guest

To instantiate an instance of Access, you will need at least the runtime
installed. I have not tried to do the things you are trying, so I don't know
if it supports that or not, but I think it should.
 
J

Jim Satterfield

Well, I'm still trying to find someplace with information on using the
Access 2000 runtime with VB6 and there's not much out there. One thing that
I found on the Microsoft site was that the runtime does not support
CreateObject but does support GetObject. This makes me wonder if the line
Set appAccess = CreateObject("Access.Application") will work and it's not
clear that substituting GetObject will work either.
 
G

Guest

Sorry, Jim, I would not have an answer for you. I have not worked with VB6
using Access; however, I do know you can use Access as a data source for a
VB6 application. That is what we used when I took a course in VB6, but it
has been a while, so I don't really remember how to do it.
 
J

Jim Satterfield

Well, what I've determined is that it will not work for me. The reason is
that you cannot use the runtime to open a report in design view, which you
can do via VB6 if Access is actually installed.. If you're unable to do that
you can't make the changes necessary to set the report back to using legal
size paper. Thanks for all the feedback.


Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top