Link to home
Start Free TrialLog in
Avatar of donb1
donb1

asked on

View picture from Access database

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?
Avatar of jamauss
jamauss

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.
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.
Avatar of Brendt Hess
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.
ASKER CERTIFIED SOLUTION
Avatar of mark2150
mark2150

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of donb1

ASKER

mark2150
  Sounds good, but How do I make a pointer?
Avatar of donb1

ASKER

mark2150's comment is more relevant, but I need to know how to make a pointer.
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
Avatar of donb1

ASKER

Thanks
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