473,785 Members | 2,235 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Embedding images into a table

I want to embed some BMP files into an OLE field (called BMP) in an
existing table using code. I've created the code that grabs the
filename from the image folder, finds the corresponding record in the
table and opens that record for editing (RST.Edit). However, I'm
having difficulty putting the image into the OLE field. If I borrow
from the code that appears in http://support.microsoft.com/default.aspx/kb/158941,
then at RST!BMP.Class = "Paint.Pict ure" I get the error "Method or
data member not found"; ditto with OLETypeAllowed, SorceDoc and
Action. If I just try RST!BMP = strFileName, followed by RST.Update,
then the field displays "Long Binary Data" but whatever is in it is
not an image. Clearly, I need to prepare the OLE field somehow but it
seems to be different doing it directly to the table than via a form
as per Microsoft's example.

Could someone please help me with the syntax? Many thanks
Nov 28 '07 #1
17 7890
Post the code you are using.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"anthony" <an************ *@gmail.comwrot e in message
news:dd******** *************** ***********@v4g 2000hsf.googleg roups.com...
>I want to embed some BMP files into an OLE field (called BMP) in an
existing table using code. I've created the code that grabs the
filename from the image folder, finds the corresponding record in the
table and opens that record for editing (RST.Edit). However, I'm
having difficulty putting the image into the OLE field. If I borrow
from the code that appears in
http://support.microsoft.com/default.aspx/kb/158941,
then at RST!BMP.Class = "Paint.Pict ure" I get the error "Method or
data member not found"; ditto with OLETypeAllowed, SorceDoc and
Action. If I just try RST!BMP = strFileName, followed by RST.Update,
then the field displays "Long Binary Data" but whatever is in it is
not an image. Clearly, I need to prepare the OLE field somehow but it
seems to be different doing it directly to the table than via a form
as per Microsoft's example.

Could someone please help me with the syntax? Many thanks

Nov 28 '07 #2
Apologies for the delay - here is the code

Dim strBMPDir As String
Dim strFileName As String
Dim DB As Database
Dim RST As Recordset
Dim strSQL As String

On Error GoTo errH
Set DB = CurrentDb()

strBMPDir = "i:\photos\ bmp"
strFileName = Dir(strBMPDir & "\" & "*.bmp", vbNormal)
strFileName = Left(strFileNam e, 14)
Do While Len(strFileName ) = 14
strSQL = "SELECT tblPhoto.PhotoI D, tblPhoto.Image, tblPhoto.BMP"
strSQL = strSQL & " FROM tblPhoto"
strSQL = strSQL & " WHERE (((tblPhoto.Ima ge)=" & "'" & strFileName &
"'" & "));"
Set RST = DB.OpenRecordse t(strSQL)
With RST
..Edit
!BMP.Class = "Paint.Pict ure" 'This is where it fails with "Method or
data member not found"; ditto for the next three lines
!BMP.OLETypeAll owed = acOLEEmbedded
!BMP.SourceDoc = strBMPDir & "\" & strFileName & ".bmp"
!BMP.Action = acOLECreateEmbe d
..update
strFileName = Dir
strFileName = Left(strFileNam e, 14)
Loop

X:
Exit Sub

errH:

MsgBox Err.Description
Resume X

Nov 29 '07 #3
"anthony" <an************ *@gmail.comwrot e in message
news:65******** *************** ***********@f3g 2000hsg.googleg roups.com...
Apologies for the delay - here is the code

With RST
.Edit
!BMP.Class = "Paint.Pict ure" 'This is where it fails with "Method or
data member not found"; ditto for the next three lines
!BMP.OLETypeAll owed = acOLEEmbedded
!BMP.SourceDoc = strBMPDir & "\" & strFileName & ".bmp"
!BMP.Action = acOLECreateEmbe d
I'm ready to be shot down in flames here but AIUI !Fieldname is expecting a
value for that field, I don't think there are any arguments. Does the code
compile? Do you have Option Explicit declared in the module?

Keith.
www.keithwilby.com

Nov 29 '07 #4
"anthony" <an************ *@gmail.comwrot e in message
news:65******** *************** ***********@f3g 2000hsg.googleg roups.com...

I've just read the code in the link and the names in the square brackets []
are referring to field names that the form is bound to, there's no recordset
(rs) being opened anywhere. Modifying your code to refer to the bound
fields ought to do it. Worth a try :-)

Regards,
Keith.
www.keithwilby.com

Nov 29 '07 #5
The form is unbound. What I am trying to achieve is to embed images
directly into the OLE field in the table via code on a command button
but I'm getting the syntax wrong when attempting to prepare the OLE
field to accept the bitmap

Nov 29 '07 #6
"anthony" <an************ *@gmail.comwrot e in message
news:e6******** *************** ***********@a39 g2000pre.google groups.com...
The form is unbound. What I am trying to achieve is to embed images
directly into the OLE field in the table via code on a command button
but I'm getting the syntax wrong when attempting to prepare the OLE
field to accept the bitmap
But the example uses a bound form and that's why your code is failing.
Can't you use a bound form and just replicate the example you sited in your
OP?

Nov 29 '07 #7
Can't you use a bound form and just replicate the example you sited in your
OP?
I could and I have and it all works. But I'd still like to know how
that MS code should be adapted so that the code I posted will work. It
must be possible to embed directly into a table without going via a
Bound Object Frame on a form
Nov 29 '07 #8
"anthony" <an************ *@gmail.comwrot e in message
news:7c******** *************** ***********@o6g 2000hsd.googleg roups.com...
>Can't you use a bound form and just replicate the example you sited in
your
OP?

I could and I have and it all works. But I'd still like to know how
that MS code should be adapted so that the code I posted will work. It
must be possible to embed directly into a table without going via a
Bound Object Frame on a form
Dunno, but this compiles:

rs.Fields("Fiel dName").Propert ies("Class") = "whatever"

Take it at face value, it might point you in the right direction but then
again ...

Keith.

Nov 29 '07 #9
>rs.Fields("Fie ldName").Proper ties("Class") = "whatever"

You are a devious fellow! I'll try it. Many thanks
Nov 29 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8278
by: Dean J. Garrett | last post by:
Hi, I need to create HTML e-mail from an ASP program that includes embedded images that go along with the e-mail, e.g. logos, product image, etc. Is there a technique in HTML that people use to embed images? I know that when I insert an image into an e-mail in Outlook, and I look at the HTML behind it, there is a funny tak CID: IMG hspace=0 src="cid:027301c29d8e$da6ba600$0afea8c0@MYMAIN" align=baseline border=0>
1
4483
by: Chris Nafziger | last post by:
In my code to send email from VBScript, I use standard CDOSYS code similar to the following: With oMsg Set .Configuration = oCon .To = """Admin"" <admin@mycompany.com>" .From = """Joe Admin"" <jadmin@mycompany.com>" .Subject = "Hey You!" .TextBody = "Service(s) have failed!" .Send
2
3182
by: dr_tyson | last post by:
I am trying to embed images into a wxPython app (created using Boa Constructor), but have not been able to do so. I know how to embed plots, but images seem to be a problem. I've tried using code analogous to the example given at the Matplotlib website to no avail. If anybody has been successful at this could you please post some sample code? That would be greatly appreciated. Thanks! Randy
3
5690
by: Tim T | last post by:
Hi, I hope there is someone reading this that has the answer, Please Help! I have the need to send a html email via asp.net. its easy enough to send an html email and add attachments. My question is, how to you set the Content-Location of each attachment in the mail headers so that the images are embedded in the html email rather than attached? This is my code:
0
1918
by: Robin Tucker | last post by:
At the moment I have place-holders in my Word document (before you say it, yes I've posted this query in the VBA newsgroups but they are a little slow - in fact reply was non-existent!). I'm running through the document, finding the placeholders (which are jpeg images) and replacing them with OLE objects, the location of which is stored in a hyperlink on the image. The reason I'm doing this is because my reporting package flattens OLE...
6
22807
by: Edward | last post by:
I have been doing some research about embedding images in HTML using the data URL src method of the format: <img src="/-/data:image/gif;base64,<DATA>"> My question is, how does one generate this <DATA> string? I have found some on the web that I can load into my browser but if I save this image and then view in Notepad it looks much different than the string that I used in <DATA> and is full of non-alphanumeric symbols. Also, I have...
1
5194
by: MissMarie | last post by:
I've been playing around with DIV tables in myspace to better learn how to rewrite my own code for my business site without having to pay someone to design it. I've tried embedding a slideshow into a div table and after I save it I noticed that the slideshow does not show up and the embed code I added is altered. Can anyone help me figure this out? The embed code that I'm talking about is three quarters down the code page under {PHOTOS},...
0
1393
by: macap.usenet | last post by:
Hello, i am embedding System.Web.UI.WebResources in my C# Class via: I use this resource with: Page.Header.Controls.Add(new LiteralControl("<link href='"ExtJS.yui- ext.css"' rel='stylesheet' type='text/css' />"));
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10350
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.