473,398 Members | 2,404 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,398 software developers and data experts.

How to add an image to a field in a table

547 512MB
I would like to lookup an image from my pc and add it to a specific field in a form.
form name: AddSignaturesF
table: tblImageOLEs
field:signature1 (OLE object field)
I found this code from "Adezi" from an old post and needs to make more changes to it.
It finds the image, but does not add it to the "signature1" field
Expand|Select|Wrap|Line Numbers
  1. Dim varItem As Variant
  2.  
  3. With Application.FileDialog(msoFileDialogFilePicker)
  4.    With .Filters
  5.      .clear
  6.    .add "Bitmap Files", "*.bmp"
  7.      .add "JPEG Files", "*.jpg"
  8.      .add "Graphic Interchange Format Files", "*.gif"
  9.    End With
  10.               .AllowMultiSelect = False
  11.        .FilterIndex = 1
  12.        .ButtonName = "Select Graphic"
  13.        .InitialFileName = vbNullString
  14.        .InitialView = msoFileDialogViewDetails
  15.        .Title = "Load Graphic File!"
  16.           If .Show Then
  17.          Me.Signature1 = .SelectedItems(1)
  18.           End If
  19. End With
Any suggestions please. I am pleading stupid here
Mar 18 '13 #1

✓ answered by ADezii

It is a little mor4e complicated that that. Assuming that Signature1 is a 'Bound Object Frame' whose Control Source is an OLE Object Field in a Table, then:
Expand|Select|Wrap|Line Numbers
  1. Dim varItem As Variant
  2.  
  3. With Application.FileDialog(msoFileDialogFilePicker)
  4.   With .Filters
  5.     .Clear
  6.       .Add "Bitmap Files", "*.bmp"
  7.       .Add "JPEG Files", "*.jpg"
  8.       .Add "Graphic Interchange Format Files", "*.gif"
  9.   End With
  10.     .AllowMultiSelect = False
  11.     .FilterIndex = 1
  12.     .ButtonName = "Select Graphic"
  13.     .InitialFileName = vbNullString
  14.     .InitialView = msoFileDialogViewDetails
  15.     .Title = "Load Graphic File!"
  16.        If .Show Then
  17.          With Me.Signature2
  18.            .OLETypeAllowed = acOLEEmbedded
  19.            .SourceDoc = Application.FileDialog(msoFileDialogFilePicker).SelectedItems(1)
  20.            .Action = acOLECreateEmbed
  21.          End With
  22.        End If
  23. End With

4 5856
ADezii
8,834 Expert 8TB
It is a little mor4e complicated that that. Assuming that Signature1 is a 'Bound Object Frame' whose Control Source is an OLE Object Field in a Table, then:
Expand|Select|Wrap|Line Numbers
  1. Dim varItem As Variant
  2.  
  3. With Application.FileDialog(msoFileDialogFilePicker)
  4.   With .Filters
  5.     .Clear
  6.       .Add "Bitmap Files", "*.bmp"
  7.       .Add "JPEG Files", "*.jpg"
  8.       .Add "Graphic Interchange Format Files", "*.gif"
  9.   End With
  10.     .AllowMultiSelect = False
  11.     .FilterIndex = 1
  12.     .ButtonName = "Select Graphic"
  13.     .InitialFileName = vbNullString
  14.     .InitialView = msoFileDialogViewDetails
  15.     .Title = "Load Graphic File!"
  16.        If .Show Then
  17.          With Me.Signature2
  18.            .OLETypeAllowed = acOLEEmbedded
  19.            .SourceDoc = Application.FileDialog(msoFileDialogFilePicker).SelectedItems(1)
  20.            .Action = acOLECreateEmbed
  21.          End With
  22.        End If
  23. End With
Mar 19 '13 #2
neelsfer
547 512MB
thx Adezi for the effort. Its almost 100%.
The code copies the image into the signature1 field as required, but it is shown as an icon together with the file name. Is there perhaps a setting to be changed on the pc, to display the pic "live" as you open the form?
my purpose - In this instance the person capturing the order, compares the signature of the authorized person on the system, to the person that signed the order off.
Mar 19 '13 #3
zmbd
5,501 Expert Mod 4TB
Your last post there reminded me about another old thread that covers part of this: Display dynamic image in MS Access 2007
If you are using V2007 or V2010 then you should be ready to rock-n-roll. I've been using this for the past few months and it is sooooooo much easier than what I had to do in V2003.
Mar 19 '13 #4
ADezii
8,834 Expert 8TB
Set the DisplayType Property of the Unbound Object Frame to 'Content'.
Mar 19 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Bob | last post by:
Hello: I've tried showing an image field from an MS SQL Server 2000 image field on an ASP page but All I get is this http://http://new.confectioneryhouse.com/glutenfree/about.asp I added the...
2
by: J Sahoo | last post by:
Hi, I have a browse page where I am showing few fields from my SQL Server table. One of the field is Image type, all the fields are bound to a single table. I want to show the image from the...
5
by: Sukhanov Volodya | last post by:
Hello, all! Does anybody knows, how I can show an image field SQL Server using VB. NET ? I have an database, which has an table with an field which has type 'image' (the type of field) I want...
1
by: joef | last post by:
I'm converting a Delphi app to C#. The application uploads and downloads files to an image field on SQL through a webservice. With Delphi, this was done straight to SQL instead of a webservice. The...
3
by: yefei | last post by:
I need to display images in a SQL database using a gridview I search some examples, what they did is very simple add an image field, then set the folowing properties <asp:imagefield...
1
by: Kissi Asiedu | last post by:
I am trying to create a table with fields "PRODUCT ID" and "IMAGE". How do I save a picture in the image field so that I can run a report with the Product ID and the corresponding picture? Thanks...
4
by: Laurahn | last post by:
How can i send from VB 2005 a null value to a image field on a database in SQL 2005
1
by: dodgeyb | last post by:
Hi there, Trying to allow client to upload image, thumbnail it, and save it into sql table image field. Code compiles & runs but image cannot be retrieved. any clues what I'm doing wrong pls ! ...
1
by: stuart | last post by:
We have a forms application that captures comments digitally entered by an inspector and saved as an image in Sql Server. The manager of this inspector wants to be able to transfer the data in Sql...
2
by: lwannwayoo | last post by:
Hi Everybody! I have a database in Microsoft Access 2003 and I want to insert image in my Table Field. How can I don it??. I use OLE type but when i insert image to that field only the word...
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
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
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,...
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
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,...
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...
0
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...
0
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...

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.