473,383 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Access 2002 bloat using Printer object

I have been experimenting with the new Printer object in Access 2002
and discovered some unexpected database bloat. Simply assigning the
same value to a property of a report's Printer object will cause the
database to grow. Here's my test code:

Public Sub ChangeReportSettings( _
sReport As String, _
sDeviceName As String, _
Optional nIterations As Long = 1)

Dim rpt As Report
Dim i As Long

For i = 1 To nIterations
DoCmd.OpenReport sReport, acViewPreview
Set rpt = Reports(sReport)
rpt.Printer = Application.Printers(sDeviceName)
rpt.Printer.Orientation = acPRORLandscape
DoCmd.Close acReport, sReport, acSaveYes
Next i

End Sub

I thought some growth would be understandable if, for example, the
report's printer is changed from the default to a specific printer.
However, after the first iteration there really should be no change to
the report. It's not about changing the printer either. I commented
that line out and the database still grows just by setting the print
orientation over and over. What's going on here? Any ideas?

Rick Collard
www.msc-lims.com

Nov 12 '05 #1
3 2640
"Rick Collard" wrote >
What's going on here?
Obviously, some memory leakage.
Any ideas?


None for avoiding it, except to set your Report object to Nothing when you
are finished with it.

To help, apply all the Service Packs and Patches, and, as with any other
bloat, regularly Compact the Database.

Larry Linson
Microsoft Access MVP
Nov 12 '05 #2
The solution is to not perform the property assignment when there will
be no change to the property's value. Unfortunately, Where I could
have been succinct:

i = 1

I now have to be verbose:

If i <> 1 Then i = 1

just to avoid the bloat.

Rick Collard
www.msc-lims.com

On Thu, 11 Sep 2003 23:57:01 GMT, "Larry Linson"
<la**********@ntpcug.org> wrote:

None for avoiding it, except to set your Report object to Nothing when you
are finished with it.

To help, apply all the Service Packs and Patches, and, as with any other
bloat, regularly Compact the Database.

Larry Linson
Microsoft Access MVP


Nov 12 '05 #3
On Fri, 12 Sep 2003 18:19:29 GMT, dX********@bway.net (David W.
Fenton) wrote:
The solution is to not perform the property assignment when there
will be no change to the property's value. Unfortunately, Where I
could have been succinct:

i = 1

I now have to be verbose:

If i <> 1 Then i = 1

just to avoid the bloat.
Why is this bad?


It's not bad. Where I just wanted to set a property value, it struck
me as inefficient to first test the value of the property.

I guess because of my replication experience I'm used to doing this
with data:

If Me.Dirty Then Me.Dirty = False

(in a replicated database this can result in lost data because
conflicts are resolved in part based on most generations of saves
in a record)

And I don't see that the time it takes to do the test is wasted as
If/Then is short-circuited so you're really not executing any more
lines of code. Indeed, you're probably speeding up your code as
testing the value probably takes less time than writing it.


Good point. I haven't run timing tests but given the bloat you're
probably correct that the code actually executes faster without
unnecessarily assigning values to the properties. I am annoyed by the
bloat but I'm just nitpicking when it comes to the appearance of the
code.

Rick Collard
www.msc-lims.com
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: deko | last post by:
After doing a lot of vba work, I've noticed the size of my mdb has grown, even though no data or objects have been added. I've read that the following procedure will remedy this and improve...
3
by: Stickleback | last post by:
Morning All I have been developing and deploying with Office 2000 for about 3 years, mainly Access based programs and although I have gotten used to it's quirks, I am starting to feel that I...
15
by: Mark C | last post by:
All, I have exhaustingly been looking through the newsgroups in search of a way to systemically output an Access 97 report to a pdf file using the full version of Adobe Acrobat. I want the user...
4
by: bborden | last post by:
I am considering writing a database program that contains text and images with an easy to use interface for my friend's dermatology physician practice. Basically Patient information that links to...
2
by: Dean Slindee | last post by:
Anybody written code in VB.NET to: 1) show a print preview window of reports already written and stored in an Access 2002 database; or 2) execute the print of a report stored in an Access 2002...
13
by: salad | last post by:
Hi Guys: I was stuck. I needed to send a report to a file. My beautiful report(s) in Access were going to require loss of formatting with RTFs, a PITA in WordMailMerge, sending it as a text...
7
by: needin4mation | last post by:
Hi, I have an Access 2002 - 2003 database. I am using Access 2003. Whenever I link an image all it shows is the filename. Not the image. Other versions of Access can link the image just fine. ...
2
by: Blaine Manyluk | last post by:
Greetings... I have what may seem like silly questions, but I need to have the facts before I proceed with my decision. Access 2002 and 2003 can run (and modify) A2K DBs/apps without having...
1
by: groulder | last post by:
hi all, i have a problem with a network database that's used by a lot of people. people are finding, they will start the database, and if the mouse is moved over the print icon, the tooltip...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.