Report SetFocus issue

Hello, I need help adjusting the following code to work on a report. Apparently you cannot use SetFocus on a Report? I'm attempting to populate three pictures. The pictures are in a folder not the database.
For example:
Picture1 is the picture
txt_Picture1 holds the picture filename
DefaultFilePath = a server shared folder

    Dim myPicture1, myPicture2, myPicture3, File1, File2, File3 As String
    Dim DefaultFilePath As String
    DefaultFilePath = GetDefaultFilePath
    File1 = Me.txt_Picture1.Text
    myPicture1 = (DefaultFilePath & File1)
    File2 = Me.txt_Picture2.Text
    myPicture2 = (DefaultFilePath & File2)
   File3 = Me.txt_Picture3.Text
   myPicture3 = (DefaultFilePath & File3)

If File1 > "" Then
Picture1.Picture = myPicture1
End If
If File2 > "" Then
Picture2.Picture = myPicture2
End If
If File3 > "" Then
Picture3.Picture = myPicture3
End If

Me.txt_Picture2.Visible = False
Me.txt_Picture1.Visible = False
Me.txt_Picture3.Visible = False

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeCommented:
What event do you currently have this code in?

Does the report display multiple records?  if so, then it needs to be in the Detail sections Format event.  At least that is where I think I would try first.

Did you look at my response to your other question?


    Dim strFilename as string
    Dim myPicture1, myPicture2, myPicture3, File1, File2, File3 As String
    Dim DefaultFilePath As String
    DefaultFilePath = GetDefaultFilePath
    strFilename = DefaultFilePath & Me.txt_Picture1
    if dir(strFilename) = "" Then
        me.myPicture1.visible = false
        me.myPicture1.Picture = ""
        me.myPicture1.Picture = strFilename
        me.myPicture1.visible = true
    end if

    strFilename = DefaultFilePath & Me.txt_Picture2
    if dir(strFilename) = "" Then
        me.myPicture2.visible = false
        me.myPicture2.Picture = ""
        me.myPicture2.Picture = strFilename
        me.myPicture2.visible = true
    end if

    strFilename = DefaultFilePath & Me.txt_Picture3
    if dir(strFilename) = "" Then
        me.myPicture3.visible = false
        me.myPicture3.Picture = ""
        me.myPicture3.Picture = strFilename
        me.myPicture3.visible = true
    end if
gogetsomeAuthor Commented:
Thank you Fyed for you response to this thread and the last. I just read the last and will make changes and test. This is the first time I've had to work in access coming from The code above is in the reports load event if that helps. There is only one record in the report. I'm attempting to populate pictures on the report and the field in the table does not contain the full path to the picture; only the picture name.

I'm not sure what the echo does so I'm going to research your other post and come back to this one if a few. Thank you for your time.
Dale FyeCommented:
the Echo method turns of screen updates (on and off).  So the reason I mentioned that in the other post is the that if you set Echo False, then you will not see normal screen updates, although If I remember correctly, you will still see warnings and error messages.  But if when an error message is processed you don't also turn screen updates back on, you won't see any changes to the screen.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gogetsomeAuthor Commented:
You have been very helpful!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.