Display different images on Switchboard

  • Thread starter Thread starter upsman via AccessMonster.com
  • Start date Start date
U

upsman via AccessMonster.com

I have a Switchboard form on which I have been displaying a small picture of
our office in the upper left hand corner. Now we have a branch office and
they would like a picture of their office to display. How can I display the
correct picture depending on which office opens the Switchboard menu? When
the Switchboard opens, I have a field that tells me which office I'm dealing
with but I just don't know how to get the correct picture, of the two, on the
form.
 
Assuming you have the images saved in a specific folder:

M:\Sites\Images\Img1.jpg
M:\Sites\Images\Img2.jpg

The image field on the switchboard is lblImg
The site field (helpful if it's a field on the Switchboard) is Site
with possible values of 'site1' and 'site2'

You would add code to the On Load Property of the Switchboard

Public Sub Form_Load()

Dim stImg As String
Dim stSite As String

stSite = Me!Site
stImg = ""

If stSite = "site1" Then
stImg = "M:\Sites\Image\Img1.jpg"
Else
stImg = "M:\Sites\Image\Img2.jpg"
End If

Me.lblImg.Picture = stImg

End Sub

That should work, I didn't have a form to test it on though. Hope that helps
Bill
 
Back
Top