By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

Store and retrieve image in Access database

P: 52
I have a form for staff details, the details come from Access and i am using this piece of code for my List box:

Expand|Select|Wrap|Line Numbers
  1. Private Sub lstRecord_Click()
  2.     rsMyRS.FindFirst " StaffID =" & Str(Split(lstRecord.List(lstRecord.ListIndex), vbTab)(1))
  3.  
  4.     txtStaffid.Text = rsMyRS!StaffID
  5.     txtFname.Text = rsMyRS!Firstname
  6.     txtSname.Text = rsMyRS!Lastname
  7.     txtDate.Text = rsMyRS!Date
  8.     txtDob.Text = rsMyRS!DOB
  9.     txtAddress.Text = rsMyRS!Address
  10.     txtCtown.Text = rsMyRS!City_Town
  11.     txtPcode.Text = rsMyRS!Postcode
  12.     txtTel.Text = rsMyRS!Tel
  13.     txtMob.Text = rsMyRS!Mobile
  14.     txtEmail.Text = rsMyRS!Email
  15.     txtPreocc.Text = rsMyRS!Preocc
  16.     txtNote.Text = rsMyRS!Note
  17.     optTemp.Value = rsMyRS!Temporary
  18.     optPermin.Value = rsMyRS!Permanent
  19. End Sub
what i wana do is add a picture box to my form. So when I click on a different name or the StaffId in the listbox, that staffs picture should show up.

Can you please tell me how to do this and what i will need to do on Access to enable this to happen.
Feb 5 '08 #1
Share this Question
Share on Google+
5 Replies


jamesd0142
100+
P: 469
access DB with staff name/id etc and a file path to the picture.

then when a user clicks the id field etc, run a query which selects the path associated with that id number and dumps the path into the picture box url...

im sure this will work
Feb 5 '08 #2

debasisdas
Expert 5K+
P: 8,127
BTW how you have stored the image in access database ?

Is it file path or the file itself ?
Feb 5 '08 #3

P: 52
to reply to the first one as i am new to coding i don;t have much knowledge of queries and such so that will be difficult for me and to the second one I was thinking of using OLE Object as datatype and then insert the object into the place.
Feb 5 '08 #4

debasisdas
Expert 5K+
P: 8,127
I was thinking of using OLE Object as datatype and then insert the object into the place.
That is the best thing to do.

You can find related articles in the articles section if VB.
Feb 5 '08 #5

Expert 5K+
P: 8,434
Actually, there has been a big discussion here recently about the best way to store and retrieve images in a database. I think you'll find it in the HowTo's area, but it may still be in Editor's Corner. Anyway, do a search on something like "BLOB image database" and you should find it.
Feb 6 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.