How to save and image to msaccess using vb 6 code?

A

Thread Starter

Allan

Can anyone give a source code on how to save and retrive a image to msaccess database using vb 6 code?

Thanks in advance..
 
http://www.vbcity.com/forums/topic.asp?tid=78778

try that link
does this make sense also:
(a) Create a database file (MS ACCESS) having a DATAFIELD name (say image1).

(b) Place a DATA component (say DATA1) in main vb form. Select this DATA1 component and then select database name property and browse for above MS ACCESS file and select to open the file. This will save the file path.

(c) Place a text box (say text8) in vb form and set it's visible property to false. Also, select DATASOURCE property
(say DATA1) and DATAFIELD(say image1).

(d) Place a common dialog box in your form (say commondialog1).

(e) Place an image box component in your form (say image1)

(f) Now, this simple code will load and save any image present in your hard disk:

Private Sub Command4_Click()
Form1.CommonDialog1.Filter = "JPG Files|*.jpg|BMP Images|*.bmp|GIF Images|*.gif"
On Error Resume Next
Form1.CommonDialog1.ShowOpen
On Error Resume Next
Form1.CommonDialog1.CancelError = True
Form1.Text8.Text = Form1.CommonDialog1.FileName
a = Form1.Text8.Text
Form1.Image1.Picture = LoadPicture(a)

End Sub

Where, command4 button is under the caption" BROWSE" in my database project.
 
Hai...

Thanks for the code. That code is working to load image, but it's not working to save image in database. Can you show me the code to save image?
 
This only works to load a photo to the Picture control but not saving!!! How can we save it to the database please?! Thank you...
 
Top