Picture changes when record changes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nickybon@msn.com

    Picture changes when record changes

    Hi fellas,

    Im setting up a form in my Access project and I need to implement this
    rather special fucntion.

    This function is basically simple to understand but I really dont know
    how to create it. I need to implement a function that each time their
    is a record navigation a picture changes.

    Meaning = lets say I have a field with the word "football" in it - and
    their is a picture of a football next to it. Then I change record =
    changed into "rugby" and then their is a picture of a rugby ball next
    to it.

    How can I do that function?

    Cheers..
    nickybon

  • fredg

    #2
    Re: Picture changes when record changes

    On 2 May 2006 09:24:39 -0700, nickybon@msn.co m wrote:
    [color=blue]
    > Hi fellas,
    >
    > Im setting up a form in my Access project and I need to implement this
    > rather special fucntion.
    >
    > This function is basically simple to understand but I really dont know
    > how to create it. I need to implement a function that each time their
    > is a record navigation a picture changes.
    >
    > Meaning = lets say I have a field with the word "football" in it - and
    > their is a picture of a football next to it. Then I change record =
    > changed into "rugby" and then their is a picture of a rugby ball next
    > to it.
    >
    > How can I do that function?
    >
    > Cheers..
    > nickybon[/color]

    Code the Form's Current event:

    If Me![FieldName]= "Football" Then
    Me!ImageName.Pi cture = "C:\PathToPictu re\Football.jpg "
    Elseif Me![FieldName]="Rugby" Then
    Me![ImageName].Picture = "C:\PathToPictu re\Rugby.jpg"
    Else
    Me![ImageName].Picture = "C:\PathToPictu re\Cricket.jpg"
    End If

    Place the same code in the [FieldName] AfterUpdate event.
    --
    Fred
    Please respond only to this newsgroup.
    I do not reply to personal e-mail

    Comment

    • nickybon@msn.com

      #3
      Re: Picture changes when record changes

      Hi.. Thankx alot for your help.. but there seems to be a problem with
      the format..

      Can you please explain it to me step by step.. Thankx once again

      Nick

      Comment

      • nickybon@msn.com

        #4
        Re: Picture changes when record changes

        Hi.. Thankx alot for your help.. but there seems to be a problem with
        the format..

        Can you please explain it to me step by step.. Thankx once again

        Nick

        Comment

        • fredg

          #5
          Re: Picture changes when record changes

          On 2 May 2006 10:32:17 -0700, nickybon@msn.co m wrote:
          [color=blue]
          > Hi.. Thankx alot for your help.. but there seems to be a problem with
          > the format..
          >
          > Can you please explain it to me step by step.. Thankx once again
          >
          > Nick[/color]

          I don't understand what you mean by "Problem with the format".
          Did you add an Image control to the form?
          Do you have a Field that contains just the one word 'Football' or
          'Rugby', etc?
          Did you enter the correct Path to the picture, as well as it's name?

          --
          Fred
          Please respond only to this newsgroup.
          I do not reply to personal e-mail

          Comment

          • nickybon

            #6
            Re: Picture changes when record changes

            Hi Fred,

            I couldnt understand the codes you gave me. Can you tell me what I have
            to do? Go to design view? what?

            Nick

            Comment

            • fredg

              #7
              Re: Picture changes when record changes

              On 2 May 2006 14:11:55 -0700, nickybon wrote:
              [color=blue]
              > Hi Fred,
              >
              > I couldnt understand the codes you gave me. Can you tell me what I have
              > to do? Go to design view? what?
              >
              > Nick[/color]

              In Form Design view, add an Image Control to the form.
              Take note of the name of this control.

              Then still in form Design View, display the Form's Property sheet.
              Click on the Event tab
              On the line that says On Current, write
              [Event Procedure]
              Then click on the little button with three dots that appears on that
              line.
              When the code window opens, the cursor will be flashing between 2
              already existing lines of code.
              Write:

              If Me![FieldName]= "Football" Then
              Me!ImageName.Pi cture = "C:\PathToPictu re\Football.jpg "
              Elseif Me![FieldName]="Rugby" Then
              Me![ImageName].Picture = "C:\PathToPictu re\Rugby.jpg"
              Else
              Me![ImageName].Picture = "C:\PathToPictu re\Cricket.jpg"
              End If

              Between those 2 lines.

              Change [FieldName] to whatever the actual name is of the field that
              contains the word 'Football', or 'Rugby', etc.
              Change [ImageName] to whatever the name is of the Image control you
              added earlier.
              Change
              "C:\PathToPictu re\"
              to whatever the actual path is to your picture.
              Change
              Football.jpg
              to whatever the actual name and extension is of your picture.

              When done, save this code.

              Then place the same code in the [FieldName] AfterUpdate event.
              Click on the [FieldName] control.
              Show it's property sheet. Click on the Event tab. Write
              [Event Procedure]
              on the AfterUpdate line. Click on the button with 3 dots and follow
              the same instructions as you did for the Current event.

              Save these changes as well.

              --
              Fred
              Please respond only to this newsgroup.
              I do not reply to personal e-mail

              Comment

              Working...