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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form opening from Picture Hyperlink 1

Status
Not open for further replies.

BakerUSMC

Technical User
May 24, 2003
96
US
Hello to all,

I have a hyperlink to open a picture on an image control. I finally got it to work after numerous hours... But the problem is that once the hyperlink runs, it opens another form that contains part of the hyperlink.

location = filepath
Photo = file name
Picture = Image control


Code:
Private Sub Form_Current()

On Error Resume Next

    If Not (IsNull(Me!Photo)) Then
    Me![Image].Properties("Picture") = (Form_frmlocation!Location & Me!Photo)

    Else
    Me![Image].Properties("Picture") = ""
   
    End If
    
End Sub

I don't understand why it's opening frmlocation in the background. I hope I explained this clearly enough.

Hope someone can help!!!

Thanks,
BakerUSMC
 
This code is forcing it to load in hidden mode:
[tt]
= (Form_frmlocation!Location & Me!Photo)
[/tt]
If you only want to get the path if the form is already open, you can check for that:
Code:
If CurrentProject.AllForms("frmLocation").IsLoaded Then
  strPath = Forms!frmLocation!Location
End If
You can get the "Location" value from the table the form is bound to instead of using the form field. Try using one of the database functions, such as DLookup(). To find the Location field's value in the first record in the table use DFirst():
Code:
= DFirst("Location", "tblLocations") & Me!Photo

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
VBSlammer,

WOW, your post worked perfectly!! Thanks so much!!!

BakerUSMC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top