pictures on forms..something so easy yet so difficult?

S

sek0910

As a novice, I think it should be a pretty easy thing to
display images on forms. Drag and image control to the
form. If you want to display the same image for all
records, bind the control to a specific image. If you
want to display a different pic for each record, bind the
control to a field in any underlying table containing
either the image or a path to it.

But no, at least for the latter. Am I correct that you
have to be fairly adept at vb programming to perform that
simple task? I studied the "employees" table and form
from the Northwind Database and still really couldn't
figure out exactly what had to be done to merely display
a picture. Nor am I sure how to simply add a picture to
a new record in a table!

If there is a simple way to perform this simple task,
please let me know. I can't believe Microsoft revised
this program multiple times over the past decade and
didn't provide an easy way to do this.
 
P

PC Datasheet

First, you need the full path to the image(s) stored in your table.

Drag and image control to the form.

If you want to display the same image for all records, save the full path of the
image in a field in its own table. Put the following expression in the
declarations section (Under Option Explicit) of the code module of your form:
Const ImagePath As String =
DLookup("[NameOfImageField]","NameOfSingleImageTable")

Put the following code in the OnCurrent event of your form:
Me!NameOfImageControl.Picture = ImagePath

If you want to display a different pic for each record, store the full path to
the image(s) in a field in your table. Create a hidden textbox on your form and
bind it to the image field. Put the following code in the OnCurrent event of
your form:
Me!NameOfImageControl.Picture = Me!NameOfHiddenTextBox
 

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