Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying JPEGs in a form using directories stored in text fields

Status
Not open for further replies.

TOTCOM11

Programmer
Aug 5, 2003
199
US
I have a product database and would like to have up to three jpegs display for each product (each record). I am currently using Access Object Frames to display the jpegs from three text fields: Pic1, Pic2, and Pic3 (one for each possible picture). Some records may only display 1 or 2 pictures. In the case of just one picture, the text fields Pic2 and Pic3 are plank. The names of my controls are PICTURE1, PICTURE2, and PICTURE3. I am having the hardest time trying to get the images to display. Here is my current code:

Code:
Private Sub Form_Current()

'Code to link pictures
Dim strPath1 As String
Dim strPath2 As String
Dim strPath3 As String

    On Error GoTo err_Current

    strPath1 = Nz(Me.Pic1)
    strPath2 = Nz(Me.Pic2)
    strPath3 = Nz(Me.Pic3)

    Me.PICTURE1 = strPath1
    Me.PICTURE2 = strPath2
    Me.PICTURE3 = strPath3
'End Code to link pictures
    
exit_Sub:
    Exit Sub
    
err_Current:
    MsgBox Err.Description
    Resume exit_Sub

End Sub

When I move from record to record, I do not get any error messages. Can anyone help me?
 
You should be using Image controls with their "Picture Type" properties set to "Linked." Then you can assign the paths like this:
Code:
Me.PICTURE1.Picture = "C:\Windows\Coffee Bean.bmp"
or
Me.PICTURE2.Picture = strPath2

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
You might be able to right-click them and select [tt]ChangeTo -> Image[/tt]

VBSlammer
redinvader3walking.gif

[sleeping]Unemployed in Houston, Texas
 
Thanks Slammer, your first point helped me tremendously, and unfortunately, with image controls, you cannot change them between bound, unbound, and image.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top