Using MS Access/Upload images

Advertisement


Question
Hi,

I am using access 2010 as FE. I have the BE tables on an SQL server. My question: how can I upload images? I would love to have something similar to attach files as in access which is unfortunately not available in the SQL BE tables.

Regards

Elie

Answer
First, I'm assuming that you want to associate images with a record in your database. That's not the same as Upload. To Upload means to send a file from your PC to a remote computer.

You can store images in a SQL Server table, Unfortunately, I'm not a SQL Server expert so I can't tell you much more than that.

But there is another way to work with images using Access. And that is to store the location of the image as a text field in a table. You can then display the image on an Access form using the following method.

On the form you add an unbound Image control (this is the last control in the Controls list). You then use the On Current event of your form to run code like:

If IsNull(Me.txtImagepath) then
    Me.imgControl.Picture = default pic
Else
    Me.imgControl.Picture = Me.txtImagepath
End If

You also want that same snippet in the After Update event of txtImagePath.

Note: txtImagepath is a control on your form bound to the field holding the path to the image. imgControl is the name of the Unbound Image Control and default pic is the path to a default image to show is none is associated with the record.

Hope this helps,
Scott<>
Blog: http://scottgem.wordpress.com
Website: http://www.diamondassoc.com
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.