Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    May 2002
    Location
    Patagonia Region Chile
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Relative Path to Background Image (A2k)

    Hello.

    I use images stored as jpg outside the db and linked with code using examples learned here. Thanks for showing me that!

    Right now I am trying to have the background image behave the same way.

    I use the dialogs and navigate to the file so that it the path to file reads C:/images/backgrounds/back.jpg
    Set property to Zoom and Linked.
    All is well.

    If I move or send by email for others to use,,,, (sending or moving the folder containing the MDB and images)... I need a relative path for the back ground image... right?

    In Picture property I input the relative path to image I want to use. When I open the form in design view of preview I receive an error saying that file can not be open. (see 'error.bmp' attached)

    I have tried using several different combinations (examples below) as the relative path. All produce the same error
    //folder_with_mdb_in_it/folder/file.jpg
    /folder_with_mdb_in_it/folder/file.jpg
    folder_with_mdb_in_it/folder/file.jpg
    //folder/file.jpg
    /folder/file.jpg
    folder/file.jpg

    It seems to work once. Then on close and re-open the error returns.
    I tried a decompile thinking it may be some type corruption thing... no luck.

    What seems to be the problem here?

    Thanks.

    Jason
    Attached Images Attached Images

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Relative Path to Background Image (A2k)

    You'd have to leave the background image blank in design view, and set it in code. You can use CurrentProject.Path to obtain the path of the database dynamically.

  3. #3
    Star Lounger
    Join Date
    May 2002
    Location
    Patagonia Region Chile
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Relative Path to Background Image (A2k)

    Thank you Hans. As always. Your instructions worked perfectly.

    I used the following and it worked.
    placed image file in same folder as MDB. Named image back.jpg
    Then used this code.

    Private Sub Report_Open(Cancel As Integer)

    Me.Picture = CurrentProject.path & "back.jpg"

    End Sub 'Form_Open(Cancel As Integer)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •