Solved

View picture from Access database

Posted on 2000-03-28
9
280 Views
Last Modified: 2010-05-02
I use the following to view Access database text items:

MySQL = "SELECT * FROM tAddress "
Set dbtemp = OpenDatabase(dbname)
Set rst = dbtemp.OpenRecordset(MySQL)
     ID = rst("ID")
     Last = rst("Last")
     First = rst("First")
 List1.AddItem Last & First
rst.Close

My database has a picture in a picture field.  What code do I use to display that picture in an image box?
0
Comment
Question by:donb1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:jamauss
ID: 2665292
Can pictureboxes be data bound? IF so, just set the datasource to the field in your database. Otherwise, hmm. I don't know. I've never tried that.
0
 

Expert Comment

by:yuvaraj
ID: 2665300
You've stored picture as OLE object in MSAccess in LongBinaryFormat. This can be read using a DATAControl + ImageBox linked to that database-table-field and not by using DAO.
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2665323
Take a look at the AppendChunk / GetChunk example in VB Help. (at least in VB5 Help).  It shows an example using of displaying an image from a DB.

Note that loading a picture requires it to either be in a file, or in the Clipboard.  I can't find a way to put the data straight from a variable onto the clipboard, so you need to write a file out to do this.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Accepted Solution

by:
mark2150 earned 50 total points
ID: 2665626
As bhess1 said, you can't load direct from the database into the control. Thus you'll find it 2x faster to keep the image on disk and simply keep a pointer to the image file.

This Q comes up all the time and keeping images *in* a database is a bad idea. It bloats the database, slows retreival times, doesn't scale, and generally makes things cumbersome and fragile.

If you leave the images out on disk and just keep a pointer to the file you can have more images online than any single drive or server can hold and your total image store can greatly exceed what any database can hold.

M
0
 

Author Comment

by:donb1
ID: 2665700
mark2150
  Sounds good, but How do I make a pointer?
0
 

Author Comment

by:donb1
ID: 2669067
mark2150's comment is more relevant, but I need to know how to make a pointer.
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2669117
Pointer is simply path to file; N:\IMAGES\ABC123.JPG or in UNC notation (preferred) \\Server\Drive\Dir\File.ext

Field is straight ASCII.

Control.LoadPicture trim("" & rs!pointer)

M
0
 

Author Comment

by:donb1
ID: 2669130
Thanks
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2669200
No problem. This Q comes up all the time. I've designed image processing systems for Sheriff's Departments and Jails and they have hundreds of thousands of images being updated continuously. Keeping images IN the database simply isn't practical.

M
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Add a task in Outlook from access 11 43
vb6 connector to mongodb 2 162
TT Auto Dashboard 13 104
Automatically generate a pdf file from an excel file and email out everyday 2 76
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question