473,386 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to put logo in form?

Is it possible to store a company logo (a gif file) in a table (binary
field) and have the logo appear in a form? If I insert a picture object in
the form, the properties sheet of the Image control has a Picture field that
takes a file path. How do I reference the gif file stored in the table?

Thanks in advance.
Nov 13 '05 #1
9 7761
Just bind the form to the table and add a Bound Object Frame to the
form. You can then set the Control Source property to the field
containing the image.

Nov 13 '05 #2
Load the Logo into an Image control on a Form. Now copy the Image
control's PictureData property in your Long Binary(OLE) field. You are
not embedding the Image as an OLE object into an OLE object field. This
is simply a copy of the property stored as plain binary data.

At runtime you can reverse the process and copy the contents of your
field directly to the Image control's PictureData property.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"deko" <de**@hotmail.com> wrote in message
news:XO*******************@newssvr13.news.prodigy. com...
Is it possible to store a company logo (a gif file) in a table (binary
field) and have the logo appear in a form? If I insert a picture object in the form, the properties sheet of the Image control has a Picture field that takes a file path. How do I reference the gif file stored in the table?
Thanks in advance.


Nov 13 '05 #3
> Load the Logo into an Image control on a Form. Now copy the Image
control's PictureData property in your Long Binary(OLE) field. You are
not embedding the Image as an OLE object into an OLE object field. This
is simply a copy of the property stored as plain binary data.

At runtime you can reverse the process and copy the contents of your
field directly to the Image control's PictureData property.


Thanks for the reply.

But I don't see any PictureData property in the Image controls' property
sheet. I was able to follow rsinclair's suggestion of adding a bound object
frame to the form, and then setting the Control source to the OLE Object
field in the table - but how do I get the logo into the Long Binary table
field?

This must be a very simple procedure - thanks for your patience.
Nov 13 '05 #4
> Just bind the form to the table and add a Bound Object Frame to the
form. You can then set the Control Source property to the field
containing the image.


Sounds reasonable... I found some code on the net and modified it - is this
the right way to get the logo into the Long Binary table field?

Public Function GetBlob()
On Error GoTo HandleErr
Dim strSource As String
Dim strChunk As String
Dim intSourceFile As Integer
Dim lngFileLength As Long
Dim rst As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rst = db.OpenRecordset("tblSettings")
strSource = "C:\path\to\logo.gif"
intSourceFile = FreeFile
Open strSource For Binary Access Read As intSourceFile
lngFileLength = LOF(intSourceFile)
Debug.Print lngFileLength 'returns 5767
strChunk = lngFileLength
With rst
.MoveFirst
.Edit
!Logo.AppendChunk (strChunk)
.Update
End With
Exit_Here:
On Error Resume Next
Set db = Nothing
Set rst = Nothing
Exit Function
HandleErr:
Debug.Print Err.Number & " " & Err.Description
GoTo Exit_Here
End Function
Nov 13 '05 #5
In some versions of Access, the PictureData property is mistaken marked
as hidden in the Type Libary. Open the object Browser window, right
click anywhwere and select Show Hidden Members.
Anyhow, even if the PictureData prop does not show within Intellisense
you can still use it directly.

I posted sample code. Did you even try it?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"deko" <de**@hotmail.com> wrote in message
news:A1*******************@newssvr13.news.prodigy. com...
Load the Logo into an Image control on a Form. Now copy the Image
control's PictureData property in your Long Binary(OLE) field. You are not embedding the Image as an OLE object into an OLE object field. This is simply a copy of the property stored as plain binary data.

At runtime you can reverse the process and copy the contents of your
field directly to the Image control's PictureData property.
Thanks for the reply.

But I don't see any PictureData property in the Image controls'

property sheet. I was able to follow rsinclair's suggestion of adding a bound object frame to the form, and then setting the Control source to the OLE Object field in the table - but how do I get the logo into the Long Binary table field?

This must be a very simple procedure - thanks for your patience.


Nov 13 '05 #6
You can only use an OLE Frame control to view data that has been
inserted by an application that can function as an OLE Server for the
particular file type.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"deko" <de**@hotmail.com> wrote in message
news:qF*******************@newssvr13.news.prodigy. com...
Just bind the form to the table and add a Bound Object Frame to the
form. You can then set the Control Source property to the field
containing the image.
Sounds reasonable... I found some code on the net and modified it - is

this the right way to get the logo into the Long Binary table field?

Public Function GetBlob()
On Error GoTo HandleErr
Dim strSource As String
Dim strChunk As String
Dim intSourceFile As Integer
Dim lngFileLength As Long
Dim rst As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rst = db.OpenRecordset("tblSettings")
strSource = "C:\path\to\logo.gif"
intSourceFile = FreeFile
Open strSource For Binary Access Read As intSourceFile
lngFileLength = LOF(intSourceFile)
Debug.Print lngFileLength 'returns 5767
strChunk = lngFileLength
With rst
.MoveFirst
.Edit
!Logo.AppendChunk (strChunk)
.Update
End With
Exit_Here:
On Error Resume Next
Set db = Nothing
Set rst = Nothing
Exit Function
HandleErr:
Debug.Print Err.Number & " " & Err.Description
GoTo Exit_Here
End Function


Nov 13 '05 #7
> You can only use an OLE Frame control to view data that has been
inserted by an application that can function as an OLE Server for the
particular file type.


That must explain the error I receive when I double-click the empty box that
appears in the form - "server not available" or some such thing...
Nov 13 '05 #8
> In some versions of Access, the PictureData property is mistaken marked
as hidden in the Type Libary. Open the object Browser window, right
click anywhwere and select Show Hidden Members.
Done. I see PictureData in the Object Browser, but still not in the
property sheet of the control.
Anyhow, even if the PictureData prop does not show within Intellisense
you can still use it directly.
I do see the property in the Intellisense dropdown.
I posted sample code. Did you even try it?


Sample code? You posted sample code? In this thread?

Just for grins, I tried loading the logo into the table field using that
GetBlob function (see pervious reply to rsinclair), and then cleared the
path from the Picture property of the Image control. Then I added this code
to the form module:

Private Sub Image1_Click()
Me!Image1.PictureData = Me!Logo
End Sub

I get: Run-time error 2192: The bitmap you specified is not in a
device-independent (.dib) format.

Is this a result of the way I loaded the logo into the field with GetBlob,
or because the logo is a gif?

If you could repost your sample code, I'm sure that would help.

Thanks.
Nov 13 '05 #9
The GIF file is actually converted to an Enhanced Metafile by Access
when loaded into an Image control. I ran into this issue several years
ago but honestly have forgotten the workaround.
Convert your GIF to Bitmap format and you will be able to use the code
you posted. If this is not possible/practical then you will have to work
with temp disk files.

Copy the GIF intact to the long Binary field
At runtime copy the contents fo the long Binary field to a temp disk
file. Point the Picture prop of the Image control to this temp disk
file.
It was pseudo code I posted because it is too simple to bother writing
actual code.

To save the PictureData prop:
Me!YourOLEFieldName = Me.ImageControlNamePictureData

To Load:
Me.ImageControlNamePictureData = Me!YourOLEFieldName

You seem to want to use GetChunk which is not required. Just substitute
your Recordset object for "Me" when you do not want to have the
recordset bound to the form containing the Image control.

Good luck.
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"deko" <de**@hotmail.com> wrote in message
news:I0******************@newssvr21.news.prodigy.c om...
In some versions of Access, the PictureData property is mistaken marked as hidden in the Type Libary. Open the object Browser window, right
click anywhwere and select Show Hidden Members.
Done. I see PictureData in the Object Browser, but still not in the
property sheet of the control.
Anyhow, even if the PictureData prop does not show within Intellisense you can still use it directly.


I do see the property in the Intellisense dropdown.
I posted sample code. Did you even try it?


Sample code? You posted sample code? In this thread?

Just for grins, I tried loading the logo into the table field using

that GetBlob function (see pervious reply to rsinclair), and then cleared the path from the Picture property of the Image control. Then I added this code to the form module:

Private Sub Image1_Click()
Me!Image1.PictureData = Me!Logo
End Sub

I get: Run-time error 2192: The bitmap you specified is not in a
device-independent (.dib) format.

Is this a result of the way I loaded the logo into the field with GetBlob, or because the logo is a gif?

If you could repost your sample code, I'm sure that would help.

Thanks.


Nov 13 '05 #10

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

Similar topics

6
by: Mario | last post by:
I could you print jpg or bmp from the printer commands I tried something like ; Printer.picturepaint ("92.bmp") printer.enddoc Doesn't work.. I want to be able to print a logo or a picture...
5
by: Andrew Thompson | last post by:
I have a (rather challenged) css design for my site logo at http://www.lensescapes.com/tst/photologo.jsp It shows not only the current rendering of the design, but also has links to the CSS...
21
by: Atanas Boev | last post by:
Is there any CSS way to make a <hr /> noshadow so I don't get the default 3D look in Netscape? I tried to use some border-bottom to make the line, but my "line" should be under text that is...
1
by: Joel de Guzman | last post by:
Hello, Boost (www.boost.org) is an open, collaborative effort that includes thousands of programmers from the C++ community at large. Boost is hoping to retire the existing logo...
6
by: MLH | last post by:
I have a logo image that I can paste into MS Paint as an image with clear background. Think of the logo as a black circle in a white, rectangular background. When I paste into Paint, the white...
4
by: Xah Lee | last post by:
A Lambda Logo Tour (and why LISP languages using λ as logo should not be looked upon kindly) Xah Lee, 2002-02 Dear lispers, The lambda character λ, always struck a awe in me, as with...
31
by: Michael Tobis | last post by:
"Is this the right room for an argument?" http://geosci.uchicago.edu/~tobis/snake.png ok, so my execution is pretty crude, but you can at least see my idea. I trust you to imagine it...
0
by: Tony Girgenti | last post by:
Hello. Developing a web form program with VS.NET 2003, VB, .Net Framework 1.1.4322, ASP.NET 1.1.4322, IIS 5.1. When i run it on my development machine, the logo.gif file displays on the web...
0
by: colmkav | last post by:
Hi, when I try to add a logo to my form I click on the unbounded object frame and then browse for tje location of my logo. I open the .bmp file but get an error claiming "OLE object isnt...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.