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

A97: File Size (Picts) 2

Status
Not open for further replies.

letaylor

Technical User
Nov 27, 2000
14
US
Hello,

I am creating a db to hold pictures of our property holdings at work. There are 3 pictures for each property.

The database with just property info: 336KB
The database with 9 pictures (with the picts showing in the form: 90MB
The database with 9 pictures (with the picts showing as an icon: 30MB

Why is it so big! The jpegs are each about 90KB in size. I have many more properties to add but am concerned about file size.

Can someone give me some inside to why the database grows so large with such small pics?

Thanks!
 
Might I suggest storing the path to the pictures in the database instead of the pictures themselves. You can still have them show up on forms/reports my creating a image control and changing the path of the image. This will greatly reduce the size of your database. Mike Rohde
rohdem@marshallengines.com
 
Hi Mike.

I like your suggestion, it sounds like something that will work for me. I'm not sure how to start though. Everything I've ever done in Access has always been done just in Access so I am not familiar with how to store the paths and creating an image control.

Can you lead me in the right direction?

Thanks!
-Leslie
 
You didn't mention how many you currently had in the database. Frequently the design decision is made to maintain the graphics files externally with directory pointer in the database only. Then, when the user moves between records the graphics pointer is used to update the form display at runtime.

Quote from A97 help:
You can use the SourceDoc property to specify the file to create a link to or to embed when you create a linked object or embedded object by using the Action property in Visual Basic.

Setting

For an embedded object, enter the full path and file name for the file you want to use as a template and set the Action property to acOLECreateEmbed
.
For a linked object, enter the full path and file name of the file to create a link to and set the Action property to acOLECreateLink.
You can set this property in a property sheet, in a macro, or by using Visual Basic.

Note While this property appears in the property sheet, it takes effect only after the Action property is set in a macro or by using Visual Basic.

Remarks

You can use the SourceDoc property to specify the file to create a link to and the control's SourceItem property to specify the data within that file. If you want to create a link to the entire object, leave the SourceItem property blank.

Also see, Link to an existing unbound object

Steve King Professional growth follows a healthy professional curiosity
 
In a nutshell, you just store the full path to the picture in a text field. Then using the 'on current' of a form or the 'on format' of a report, set an image control's picture property to the path.

If Not IsNull(Me.PicturePath1) Then
Me.Image1.Visible = True
Me.Image1.PICTURE = Me.picpath1
Else: Me.Image1.Visible = False Mike Rohde
rohdem@marshallengines.com
 
We used that solution in the past, but there are controls you can get that will keep your database storage overhead to a minimum. Try DbPix control. The control stores pics without the insane overhead of Access OLE objects. I have tried it and it works very well.

Gary
gwinn7
 
Thank you everyone..

Mike, that worked like a charm... Thank you

-Leslie
 
Well I thought everything worked!

I'm not sure where to put the code on my report. Mike mentioned 'on format' for the report, but there is no on format..

Am I confused :)
 
There is an 'on format' event for each section of the report, the detail, header, etc. Click on the properties for the section of the report that contains the image control and put the code in the 'on format' of that section. Mike Rohde
rohdem@marshallengines.com
 
Ahhhh... Now it all makes sense..

As you can tell I haven't used Access in awhile :)

-Leslie
 
Hmm.. I need a little more help:

In On Format under the Detail Section I have the following:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Not IsNull(Me!Pict1Path) Then
Me!Pict1.Visible = True
Me!Pict1.Picture = Me!Pict1Path
Else: Me!Pict1.Visible = False
End If
If Not IsNull(Me!Pict2Path) Then
Me!Pict2.Visible = True
Me!Pict2.Picture = Me!Pict2Path
Else: Me!Pict2.Visible = False
End If

End Sub

Pict1Path is the name of the field in my DB that contains the path
Pict1 is what I've named the image control on my report..

When I open the report I get the following error:

<<Successor Pictures can't find the field 'Pict1Path' referred to in your expression>>

But I have the same thing in a form:

Private Sub Form_Current()
If Not IsNull(Me!Pict1Path) Then
Me!Pict1.Visible = True
Me!Pict1.Picture = Me!Pict1Path
Else: Me!Pict1.Visible = False
End If
If Not IsNull(Me!Pict2Path) Then
Me!Pict2.Visible = True
Me!Pict2.Picture = Me!Pict2Path
Else: Me!Pict2.Visible = False

End If

End Sub

& it works just dandy...

Can anyone let me know why it doesn't work in the report..

-Leslie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top