By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,905 Members | 2,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,905 IT Pros & Developers. It's quick & easy.

Runtime error 2465

imrosie
100+
P: 222
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_Click()
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 acSysCmdClearStatus
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.
May 16 '07 #1
Share this Question
Share on Google+
6 Replies


Denburt
Expert 100+
P: 1,356
Well if [imgPicture] is in a subform you should address it like so:
Expand|Select|Wrap|Line Numbers
  1. me!YourSubForm.Form![imgPicture]
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.
Expand|Select|Wrap|Line Numbers
  1. Me!imageFile
May 16 '07 #2

ADezii
Expert 5K+
P: 8,638
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_Click()
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 acSysCmdClearStatus
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?
May 16 '07 #3

imrosie
100+
P: 222
Well if [imgPicture] is in a subform you should address it like so:
Expand|Select|Wrap|Line Numbers
  1. me!YourSubForm.Form![imgPicture]
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.
Expand|Select|Wrap|Line Numbers
  1. Me!imageFile

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
May 16 '07 #4

Denburt
Expert 100+
P: 1,356
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:
Expand|Select|Wrap|Line Numbers
  1. Me!subformname[imgPicture]
Should read:
Expand|Select|Wrap|Line Numbers
  1. Me!subformname.form![imgPicture]
This may or may not be the problem let us know.
May 16 '07 #5

imrosie
100+
P: 222
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:
Expand|Select|Wrap|Line Numbers
  1. Me!subformname[imgPicture]
Should read:
Expand|Select|Wrap|Line Numbers
  1. Me!subformname.form![imgPicture]
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
May 17 '07 #6

Denburt
Expert 100+
P: 1,356
Glad I could be of help let us know if you have any further questions.
May 17 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.