How do I link a bitmap to a bound object frame ?

G

Guest

I have a continuous form to select a country and i want to add a small bitmap
flag to each. How can I link a bound object frame to each bitmap, when the
bound object frame does not seem to offer a suitable event on which to hang
VBA?
 
S

Stephen Lebans

I think you would have to create a seperate table with two fields. An
indexed key field representing the Country code and an OLE object field
where you would embed the small graphic for the respective flag.
Use a Query to produce the recordsource for the form linking each row from
your main table to the "Flags" table containing the Bitmap.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guest

Stephen, thank you, but that still means embedding the bitmaps within the
database. Is there a way of linking the bound object frame to and external
set of bitmaps?
 
S

Stephen Lebans

For a form in Continuous view, the only method available involves the use of
a Bound OLE Frame control, and as you surmised, embedded Images.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guest

I'm attempting to do something very similar. How do you embed the bitmap
image in the OLE Object field for each record in the table?
 
S

Stephen Lebans

Have you looked in the Access Help file?

Open the table table containing an OLE field. RIght Click on the field and
select insert object.

I would make every bitmap a MS Paint object. This is important if you will
distributing your application to other desktops.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guest

Stephen, then the next question is how do I mimic drag and drop in VBA? If I
drag a bitmap into the table in datasheet view, it says "Bitmap Image" and
displays correctly in a form, but if I set the cell equal to the path and
file name of the bitmap in VBA, the table says "Binary Information" and will
only display a blank.
Mike
 
G

Guest

I have a folder full of flags each drawn as a bitmap. When I enter a new
country into the Access database, I want to write a piece of software in VBA
to display the folder and the flags inside, then allow the user to select one
flag and have it automatically embedded in the relevant Access table in the
correct place. The first two bits I can do, it is purely the embeddidng of
an external bitmap that is causing a problem.
Mike
 
S

Stephen Lebans

It's nothing to programmatically insert the Bitmap file into the OLE field.
Here's a sample for a Word Doc. You'll have to change it support MS Paint
BMP's instead which would be class "Paint.Picture". As teh sampel indicates,
you will need a Bound OLE Frame control on your form. You can make it hidden
if you don't want the user to see it at this point in your UI.

Private Sub cmdOLEAuto_Click()
On Error GoTo Error_cmdOLEAuto_Click
With Me![OLEWordDoc]
.Enabled = True
.Locked = False
' Specify what kind of object can appear in the field.
.OLETypeAllowed = acOLEEmbedded
' Class statement for Word document.
.Class = "Word.Document"
' Specify the file to be embedded.
' Type the correct path name.
.SourceDoc = "c:\<pathname>\TestOLEAuto.doc"
' Create the embedded object.
.Action = acOLECreateEmbed
' Optional size adjustment.
.SizeMode = acOLESizeZoom
End With
Exit_cmdOLEAuto_Click:
Exit Sub
Error_cmdOLEAuto_Click:
MsgBox CStr(Err) & " " & Err.Description
Resume Exit_cmdOLEAuto_Click
End Sub


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
G

Guest

Stephen, that is fine: I can now use VBA to display the flag in an unbound
frame on a form, and I can even copy the flag to the Clipboard if I add
".Action acOLECopy" to your code, but how can I use VBA to embed that flag
into an OLEobject field of a table? Though I can drag and drop the image
manually, there are over 250 flags in my table and I want to be able to
update the table automatically. If I am to display the flags beside the
relevant country names on a continuous form I believe there is no alternative
but to embed them in the table (please see my original question).

Stephen Lebans said:
It's nothing to programmatically insert the Bitmap file into the OLE field.
Here's a sample for a Word Doc. You'll have to change it support MS Paint
BMP's instead which would be class "Paint.Picture". As teh sampel indicates,
you will need a Bound OLE Frame control on your form. You can make it hidden
if you don't want the user to see it at this point in your UI.

Private Sub cmdOLEAuto_Click()
On Error GoTo Error_cmdOLEAuto_Click
With Me![OLEWordDoc]
.Enabled = True
.Locked = False
' Specify what kind of object can appear in the field.
.OLETypeAllowed = acOLEEmbedded
' Class statement for Word document.
.Class = "Word.Document"
' Specify the file to be embedded.
' Type the correct path name.
.SourceDoc = "c:\<pathname>\TestOLEAuto.doc"
' Create the embedded object.
.Action = acOLECreateEmbed
' Optional size adjustment.
.SizeMode = acOLESizeZoom
End With
Exit_cmdOLEAuto_Click:
Exit Sub
Error_cmdOLEAuto_Click:
MsgBox CStr(Err) & " " & Err.Description
Resume Exit_cmdOLEAuto_Click
End Sub


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


MikeT said:
I have a folder full of flags each drawn as a bitmap. When I enter a new
country into the Access database, I want to write a piece of software in
VBA
to display the folder and the flags inside, then allow the user to select
one
flag and have it automatically embedded in the relevant Access table in
the
correct place. The first two bits I can do, it is purely the embeddidng
of
an external bitmap that is causing a problem.
Mike
 
M

McFestoe

Mike

I have just found your thread and are at the moment trying to do what i
think you have acheived, did you get it working with the above code or did
you have to change it, VBA code is a new thing to me and i seam to be
leaning all the time.

What iam trying to do is store electonic service sheets with the customers
signature on, so i can get rid of some paperwork and store thing
electronically, could you let me know how far you have got and how you have
done it.

Thanks

Rich




MikeT said:
Stephen, that is fine: I can now use VBA to display the flag in an unbound
frame on a form, and I can even copy the flag to the Clipboard if I add
".Action acOLECopy" to your code, but how can I use VBA to embed that flag
into an OLEobject field of a table? Though I can drag and drop the image
manually, there are over 250 flags in my table and I want to be able to
update the table automatically. If I am to display the flags beside the
relevant country names on a continuous form I believe there is no
alternative
but to embed them in the table (please see my original question).

Stephen Lebans said:
It's nothing to programmatically insert the Bitmap file into the OLE
field.
Here's a sample for a Word Doc. You'll have to change it support MS Paint
BMP's instead which would be class "Paint.Picture". As teh sampel
indicates,
you will need a Bound OLE Frame control on your form. You can make it
hidden
if you don't want the user to see it at this point in your UI.

Private Sub cmdOLEAuto_Click()
On Error GoTo Error_cmdOLEAuto_Click
With Me![OLEWordDoc]
.Enabled = True
.Locked = False
' Specify what kind of object can appear in the field.
.OLETypeAllowed = acOLEEmbedded
' Class statement for Word document.
.Class = "Word.Document"
' Specify the file to be embedded.
' Type the correct path name.
.SourceDoc = "c:\<pathname>\TestOLEAuto.doc"
' Create the embedded object.
.Action = acOLECreateEmbed
' Optional size adjustment.
.SizeMode = acOLESizeZoom
End With
Exit_cmdOLEAuto_Click:
Exit Sub
Error_cmdOLEAuto_Click:
MsgBox CStr(Err) & " " & Err.Description
Resume Exit_cmdOLEAuto_Click
End Sub


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


MikeT said:
I have a folder full of flags each drawn as a bitmap. When I enter a
new
country into the Access database, I want to write a piece of software
in
VBA
to display the folder and the flags inside, then allow the user to
select
one
flag and have it automatically embedded in the relevant Access table in
the
correct place. The first two bits I can do, it is purely the
embeddidng
of
an external bitmap that is causing a problem.
Mike

:

What is it exactly you want to do?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephen, then the next question is how do I mimic drag and drop in
VBA?
If I
drag a bitmap into the table in datasheet view, it says "Bitmap
Image"
and
displays correctly in a form, but if I set the cell equal to the
path
and
file name of the bitmap in VBA, the table says "Binary Information"
and
will
only display a blank.
Mike

:

For a form in Continuous view, the only method available involves
the
use
of
a Bound OLE Frame control, and as you surmised, embedded Images.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephen, thank you, but that still means embedding the bitmaps
within
the
database. Is there a way of linking the bound object frame to
and
external
set of bitmaps?

:

I think you would have to create a seperate table with two
fields.
An
indexed key field representing the Country code and an OLE
object
field
where you would embed the small graphic for the respective flag.
Use a Query to produce the recordsource for the form linking
each
row
from
your main table to the "Flags" table containing the Bitmap.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


I have a continuous form to select a country and i want to add
a
small
bitmap
flag to each. How can I link a bound object frame to each
bitmap,
when
the
bound object frame does not seem to offer a suitable event on
which
to
hang
VBA?
 
S

Stephen Lebans

Did you try the code I posted with an OLE Frame control BOUND to an OLE
field?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


MikeT said:
Stephen, that is fine: I can now use VBA to display the flag in an unbound
frame on a form, and I can even copy the flag to the Clipboard if I add
".Action acOLECopy" to your code, but how can I use VBA to embed that flag
into an OLEobject field of a table? Though I can drag and drop the image
manually, there are over 250 flags in my table and I want to be able to
update the table automatically. If I am to display the flags beside the
relevant country names on a continuous form I believe there is no
alternative
but to embed them in the table (please see my original question).

Stephen Lebans said:
It's nothing to programmatically insert the Bitmap file into the OLE
field.
Here's a sample for a Word Doc. You'll have to change it support MS Paint
BMP's instead which would be class "Paint.Picture". As teh sampel
indicates,
you will need a Bound OLE Frame control on your form. You can make it
hidden
if you don't want the user to see it at this point in your UI.

Private Sub cmdOLEAuto_Click()
On Error GoTo Error_cmdOLEAuto_Click
With Me![OLEWordDoc]
.Enabled = True
.Locked = False
' Specify what kind of object can appear in the field.
.OLETypeAllowed = acOLEEmbedded
' Class statement for Word document.
.Class = "Word.Document"
' Specify the file to be embedded.
' Type the correct path name.
.SourceDoc = "c:\<pathname>\TestOLEAuto.doc"
' Create the embedded object.
.Action = acOLECreateEmbed
' Optional size adjustment.
.SizeMode = acOLESizeZoom
End With
Exit_cmdOLEAuto_Click:
Exit Sub
Error_cmdOLEAuto_Click:
MsgBox CStr(Err) & " " & Err.Description
Resume Exit_cmdOLEAuto_Click
End Sub


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


MikeT said:
I have a folder full of flags each drawn as a bitmap. When I enter a
new
country into the Access database, I want to write a piece of software
in
VBA
to display the folder and the flags inside, then allow the user to
select
one
flag and have it automatically embedded in the relevant Access table in
the
correct place. The first two bits I can do, it is purely the
embeddidng
of
an external bitmap that is causing a problem.
Mike

:

What is it exactly you want to do?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephen, then the next question is how do I mimic drag and drop in
VBA?
If I
drag a bitmap into the table in datasheet view, it says "Bitmap
Image"
and
displays correctly in a form, but if I set the cell equal to the
path
and
file name of the bitmap in VBA, the table says "Binary Information"
and
will
only display a blank.
Mike

:

For a form in Continuous view, the only method available involves
the
use
of
a Bound OLE Frame control, and as you surmised, embedded Images.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephen, thank you, but that still means embedding the bitmaps
within
the
database. Is there a way of linking the bound object frame to
and
external
set of bitmaps?

:

I think you would have to create a seperate table with two
fields.
An
indexed key field representing the Country code and an OLE
object
field
where you would embed the small graphic for the respective flag.
Use a Query to produce the recordsource for the form linking
each
row
from
your main table to the "Flags" table containing the Bitmap.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


I have a continuous form to select a country and i want to add
a
small
bitmap
flag to each. How can I link a bound object frame to each
bitmap,
when
the
bound object frame does not seem to offer a suitable event on
which
to
hang
VBA?
 
G

Guest

My mistake! I used your code with an UNBOUND Frame - it worked perfectly but
did nothing to the original table. I shall now try the same code with a
bound frame, which I understand will then amend the table to which it is
bound! Thank you for your help - I think I have just about solved my
problem. Mike

Stephen Lebans said:
Did you try the code I posted with an OLE Frame control BOUND to an OLE
field?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


MikeT said:
Stephen, that is fine: I can now use VBA to display the flag in an unbound
frame on a form, and I can even copy the flag to the Clipboard if I add
".Action acOLECopy" to your code, but how can I use VBA to embed that flag
into an OLEobject field of a table? Though I can drag and drop the image
manually, there are over 250 flags in my table and I want to be able to
update the table automatically. If I am to display the flags beside the
relevant country names on a continuous form I believe there is no
alternative
but to embed them in the table (please see my original question).

Stephen Lebans said:
It's nothing to programmatically insert the Bitmap file into the OLE
field.
Here's a sample for a Word Doc. You'll have to change it support MS Paint
BMP's instead which would be class "Paint.Picture". As teh sampel
indicates,
you will need a Bound OLE Frame control on your form. You can make it
hidden
if you don't want the user to see it at this point in your UI.

Private Sub cmdOLEAuto_Click()
On Error GoTo Error_cmdOLEAuto_Click
With Me![OLEWordDoc]
.Enabled = True
.Locked = False
' Specify what kind of object can appear in the field.
.OLETypeAllowed = acOLEEmbedded
' Class statement for Word document.
.Class = "Word.Document"
' Specify the file to be embedded.
' Type the correct path name.
.SourceDoc = "c:\<pathname>\TestOLEAuto.doc"
' Create the embedded object.
.Action = acOLECreateEmbed
' Optional size adjustment.
.SizeMode = acOLESizeZoom
End With
Exit_cmdOLEAuto_Click:
Exit Sub
Error_cmdOLEAuto_Click:
MsgBox CStr(Err) & " " & Err.Description
Resume Exit_cmdOLEAuto_Click
End Sub


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


I have a folder full of flags each drawn as a bitmap. When I enter a
new
country into the Access database, I want to write a piece of software
in
VBA
to display the folder and the flags inside, then allow the user to
select
one
flag and have it automatically embedded in the relevant Access table in
the
correct place. The first two bits I can do, it is purely the
embeddidng
of
an external bitmap that is causing a problem.
Mike

:

What is it exactly you want to do?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephen, then the next question is how do I mimic drag and drop in
VBA?
If I
drag a bitmap into the table in datasheet view, it says "Bitmap
Image"
and
displays correctly in a form, but if I set the cell equal to the
path
and
file name of the bitmap in VBA, the table says "Binary Information"
and
will
only display a blank.
Mike

:

For a form in Continuous view, the only method available involves
the
use
of
a Bound OLE Frame control, and as you surmised, embedded Images.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephen, thank you, but that still means embedding the bitmaps
within
the
database. Is there a way of linking the bound object frame to
and
external
set of bitmaps?

:

I think you would have to create a seperate table with two
fields.
An
indexed key field representing the Country code and an OLE
object
field
where you would embed the small graphic for the respective flag.
Use a Query to produce the recordsource for the form linking
each
row
from
your main table to the "Flags" table containing the Bitmap.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


I have a continuous form to select a country and i want to add
a
small
bitmap
flag to each. How can I link a bound object frame to each
bitmap,
when
the
bound object frame does not seem to offer a suitable event on
which
to
hang
VBA?
 
G

Guest

Please see my answer to Stephen Lebans below. I can now search a folder of
bitmaps outside Access, copy the images into an Access table and display them
alongside the relevant table entries in a continuous form. The code provided
by Stephen worked perfectly - I just applied it wrongly at first. Mike

McFestoe said:
Mike

I have just found your thread and are at the moment trying to do what i
think you have acheived, did you get it working with the above code or did
you have to change it, VBA code is a new thing to me and i seam to be
leaning all the time.

What iam trying to do is store electonic service sheets with the customers
signature on, so i can get rid of some paperwork and store thing
electronically, could you let me know how far you have got and how you have
done it.

Thanks

Rich




MikeT said:
Stephen, that is fine: I can now use VBA to display the flag in an unbound
frame on a form, and I can even copy the flag to the Clipboard if I add
".Action acOLECopy" to your code, but how can I use VBA to embed that flag
into an OLEobject field of a table? Though I can drag and drop the image
manually, there are over 250 flags in my table and I want to be able to
update the table automatically. If I am to display the flags beside the
relevant country names on a continuous form I believe there is no
alternative
but to embed them in the table (please see my original question).

Stephen Lebans said:
It's nothing to programmatically insert the Bitmap file into the OLE
field.
Here's a sample for a Word Doc. You'll have to change it support MS Paint
BMP's instead which would be class "Paint.Picture". As teh sampel
indicates,
you will need a Bound OLE Frame control on your form. You can make it
hidden
if you don't want the user to see it at this point in your UI.

Private Sub cmdOLEAuto_Click()
On Error GoTo Error_cmdOLEAuto_Click
With Me![OLEWordDoc]
.Enabled = True
.Locked = False
' Specify what kind of object can appear in the field.
.OLETypeAllowed = acOLEEmbedded
' Class statement for Word document.
.Class = "Word.Document"
' Specify the file to be embedded.
' Type the correct path name.
.SourceDoc = "c:\<pathname>\TestOLEAuto.doc"
' Create the embedded object.
.Action = acOLECreateEmbed
' Optional size adjustment.
.SizeMode = acOLESizeZoom
End With
Exit_cmdOLEAuto_Click:
Exit Sub
Error_cmdOLEAuto_Click:
MsgBox CStr(Err) & " " & Err.Description
Resume Exit_cmdOLEAuto_Click
End Sub


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


I have a folder full of flags each drawn as a bitmap. When I enter a
new
country into the Access database, I want to write a piece of software
in
VBA
to display the folder and the flags inside, then allow the user to
select
one
flag and have it automatically embedded in the relevant Access table in
the
correct place. The first two bits I can do, it is purely the
embeddidng
of
an external bitmap that is causing a problem.
Mike

:

What is it exactly you want to do?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephen, then the next question is how do I mimic drag and drop in
VBA?
If I
drag a bitmap into the table in datasheet view, it says "Bitmap
Image"
and
displays correctly in a form, but if I set the cell equal to the
path
and
file name of the bitmap in VBA, the table says "Binary Information"
and
will
only display a blank.
Mike

:

For a form in Continuous view, the only method available involves
the
use
of
a Bound OLE Frame control, and as you surmised, embedded Images.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Stephen, thank you, but that still means embedding the bitmaps
within
the
database. Is there a way of linking the bound object frame to
and
external
set of bitmaps?

:

I think you would have to create a seperate table with two
fields.
An
indexed key field representing the Country code and an OLE
object
field
where you would embed the small graphic for the respective flag.
Use a Query to produce the recordsource for the form linking
each
row
from
your main table to the "Flags" table containing the Bitmap.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


I have a continuous form to select a country and i want to add
a
small
bitmap
flag to each. How can I link a bound object frame to each
bitmap,
when
the
bound object frame does not seem to offer a suitable event on
which
to
hang
VBA?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top