help with subform and picture

scoob8254

Registered User.
Local time
Today, 15:47
Joined
Mar 2, 2008
Messages
76
hello, prob an easy one but is baffling me

i have a form with a picture and an embedded sub form which is in datasheet view, in their is a field called image which holds the paths to various images

id like the picture to update and show the image related to the path when i click the different records in the subform

was wondering how to do this as the picture doesnt have a control source, ive tried adding code like below to the on click etc but doesnt work

[Image1].Picture = [frmSubCatch].Form![Image]
 
can you try this:

dim picpath as string
picpath=[frmSubCatch].Form![Image]

[Image1].Picture = picpath
 
for some reason couldnt get it working last night, got it working but would def pref to use your method marianne, tried something similar last night but couldnt get it working, inserted your code and get error

runtime error 2465
database cant find the field "|" reffered to in your expression

cant undetsrantd wher eive gone wrong lol

only way i managed to get it working is to create a text box and set the control source to the image field in the subform then have a string refer to the text box, which works but is a bit of a poo way to do it
 
Last edited:
nm sorted, nothing seemed to work so deleted the sub form and any code ive placed anywhere to do with this then recreated the sub form, and used code blow and works fine, must a cocked it up at some point with my experimenting

Private Sub Form_Current()
Dim picpath As String
If IsNull([Image]) Then
Forms![frmAddTrip]![Image1].Picture = "C:\Fish DB\images\default\nopic.jpg"
Else
picpath = [Image]
Forms![frmAddTrip]![Image1].Picture = picpath
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom