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

Insert Picture From Disk To Ms Access Use Vb code???

Status
Not open for further replies.

0000000001

Programmer
Dec 13, 2002
4
BD
Hi,
i want to insert picture from disk(d:\a1.bmp)to Ms Access
field(*.mdb)by using vb code.instead of using "Insert Object
box"
i,e Picture(d:\a1.bmp) save into backend Ms Access(*.mdb) as an OLE Object(bitmap Image)from Vb(frontend)application.
using Vb code or Funtion.
thanks.
nazmul
 
Hello

Have you already found a solution to your problem? I am stuck with the same problem right now and I would want to know if it is possible

greetz

Mim
 
Here would be some examples

' To Add Picture From a File to an OLE Field in Table
' Bound to a Bound Object Field On Form
Me.MyPic.SourceDoc = "C:\Fcs\FCS LOGO Bmp.bmp" 'PassFileName
Me.MyPic.Action = acOLECreateEmbed

' To Add Picture From a File to an Image Control on Form
Me.MyPic2.Picture = "C:\Fcs\FCS LOGO Bmp.bmp"

' To Add Picture From a File to an Record Set Field
' Note Field is 'OLE Object'
Me.Recordset.edit
Set Me.Recordset!MyPic2 = Me.Recordset!MyPic
Me.Recordset.Update


HOpe these help
Access Add-on developer
 
Hello Hap007

If I understand it correctly, 'MyPic' is an OLE control on a form and 'MyPic2' an Image control on a form.
This I get...

But I don't quite understand this line

Set Me.Recordset!MyPic2 = Me.Recordset!MyPic

Shouldn't it be something like

Set Me.Recordset!MyPic2 = Me.Mypic

?

greetz

Mim
 
Mim,

No, the line below:

Set Me.Recordset!MyPic2 = Me.Recordset!MyPic

Was just an example of moving a picture from one ole data field in a record set to another field in the record set. It was just an example. Note: To move a ole object (image in this case) you need to use the 'Set' command.

Sorry if I confused you. Normally, the move would be between two different record sets, but I was just illustrating how you might do that.

Have a Super Day,
Hap... Access Add-on developer
 
Ok, now we know how to add Picture From a File to an Record, but how to retrieve that picture from the record back to the disk?

For long, I am trying to find answer...

Thanks

 
Huh? The record just contains a pointer to the disk file, yes? it is not like the record actually holds the bits and bytes that make up the actual file. The file IS on the disk. So I am not sure what you mean by retrieve the picture from the record back to the disk. You could retrieve the location of the file, and use that to load the picture file somewhere else. But you would still be loading it FROM the disk, not the record.

or am I missing something?

Gerry
 
In access table field can be type OLE, or in SQL corresponding would be IMAGE.
In that type of field you can store files (images, documents, whatever ...). NOT FILE PATHS.

It is not very efficient way to work, but in some situation is necessary. In my case, admin does not allow me to upload files to server, so I am forced to use database to store files.

So, I use HTML form (in combination with ASP) to send image or document to table. Question is, how to get it back from table.
I need to do either of these two things (Using Access VBA) :
1)Attach file to an email and send it to somebody.
How to attach such file?

2)Save file first localy and then send it...
How to save it? If I know how to save it, I would know how to attach file wich is saved.

The thing that driving me crazy is that Microsoft has that OLE type field, but no single explanation how that may be used. Or, I am not able to find it.

Thanks.
Here is the link for uploading to database, so you can better understand what I am talking about:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top