Runtime error 2465

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • imrosie
    New Member
    • May 2007
    • 222

    Runtime error 2465

    hello experts,

    Im a newbie in need of someone's experience. I have an image repository db that allows the input and search images just fine. However, if I want to erase an image, the subroutine doesn't allow it. I get a compile error everytime and I've tried to correct with no success. Here's the code:

    Private Sub cmdErasePic_Cli ck()
    If Not IsNull([imageFile]) Then
    If MsgBox("The image will be removed from this record. Are you sure?", vbYesNo + vbQuestion) = vbYes Then
    [imgPicture].Picture = ""
    [imageFile] = Null
    SysCmd acSysCmdClearSt atus
    Call Form_Current
    End If
    End If
    End Sub


    The imgPicture is a part of the subform within the form. imageFile is the actual picture stored within the image table.

    The message I get is "Microsoft Access can't find the field '|' referred to in your expression.What could I be missing? Please help...thanks in advance.
  • Denburt
    Recognized Expert Top Contributor
    • Mar 2007
    • 1356

    #2
    Well if [imgPicture] is in a subform you should address it like so:
    [CODE=VB]me!YourSubForm. Form![imgPicture][/CODE]

    You mentioned the [imageFile] is a field in a table but I am not sure which form is tied to this table or if it even is. If the [imageFile] is in a table that is bound to the subform then you will address it the same other wise you need to make sure it is also adressed somehow even if it is on the form with the button. [CODE=vb]Me!imageFile[/CODE]

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      Originally posted by imrosie
      hello experts,

      Im a newbie in need of someone's experience. I have an image repository db that allows the input and search images just fine. However, if I want to erase an image, the subroutine doesn't allow it. I get a compile error everytime and I've tried to correct with no success. Here's the code:

      Private Sub cmdErasePic_Cli ck()
      If Not IsNull([imageFile]) Then
      If MsgBox("The image will be removed from this record. Are you sure?", vbYesNo + vbQuestion) = vbYes Then
      [imgPicture].Picture = ""
      [imageFile] = Null
      SysCmd acSysCmdClearSt atus
      Call Form_Current
      End If
      End If
      End Sub


      The imgPicture is a part of the subform within the form. imageFile is the actual picture stored within the image table.

      The message I get is "Microsoft Access can't find the field '|' referred to in your expression.What could I be missing? Please help...thanks in advance.
      The Error is being generated from the line ==I> If Not IsNull([imageFile]) Then
      What exectly is [imageFile] referring to?

      Comment

      • imrosie
        New Member
        • May 2007
        • 222

        #4
        Originally posted by Denburt
        Well if [imgPicture] is in a subform you should address it like so:
        [CODE=VB]me!YourSubForm. Form![imgPicture][/CODE]

        You mentioned the [imageFile] is a field in a table but I am not sure which form is tied to this table or if it even is. If the [imageFile] is in a table that is bound to the subform then you will address it the same other wise you need to make sure it is also adressed somehow even if it is on the form with the button. [CODE=vb]Me!imageFile[/CODE]

        Hello and thanks for your quick reply. I did use the Me!subformname[imgPicture], that took away the earlier msg and now gives me a new one, 438 (object doesn't support this property or method. ???

        As for imageFile , it is a field in the image table (with the stored paths to images). The main form is based off of this table (imageFile and other field). The subform is a part of the main form.

        Any suggestions on the 438? thanks so much

        Comment

        • Denburt
          Recognized Expert Top Contributor
          • Mar 2007
          • 1356

          #5
          These error messages that you are referring to usually have a button that says debug if you hit that what line of code turns yellow?
          I will guess that you may have mis typed something or there may be another issue altogether. When I read your last post I noticed that it contained the following line:
          [CODE=VB]Me!subformname[imgPicture][/CODE]

          Should read:
          [CODE=VB]Me!subformname. form![imgPicture][/CODE]
          This may or may not be the problem let us know.

          Comment

          • imrosie
            New Member
            • May 2007
            • 222

            #6
            Originally posted by Denburt
            These error messages that you are referring to usually have a button that says debug if you hit that what line of code turns yellow?
            I will guess that you may have mis typed something or there may be another issue altogether. When I read your last post I noticed that it contained the following line:
            [CODE=VB]Me!subformname[imgPicture][/CODE]

            Should read:
            [CODE=VB]Me!subformname. form![imgPicture][/CODE]
            This may or may not be the problem let us know.
            Thanks so much.....you were right. I changed it to your suggestion and 438 went away. I appreciate that. sorry for delay in getting back....I was pulled away to many meetings yesterday.

            take care

            Comment

            • Denburt
              Recognized Expert Top Contributor
              • Mar 2007
              • 1356

              #7
              Glad I could be of help let us know if you have any further questions.

              Comment

              Working...