Run Time Error 2465

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello:

I feel a little foolish because I don't know if I have enough information to
ask an intelligent question, but I'm dumb enough to give it a try.

I inserted a query into the form's that uses the Requery feature after an
Update Event. At least I think that's the terminology. Now when I enter new
data, it works, but a VB dialog box pops up saying
----------------------------------------------------------------------------------------------
" Run Time Error 2465".

MS Access can't find the field 'qryCountExer_CurrYR' referred to in your
expression.
-----------------------------------------------------------------------------------------------

I tried everything I could think of but I can't get rid of this Visual Basic
dialog box. I imagine if I delete the query the VB dialog box will go away.

Note: Once again, I can enter the data and save it with no problem, but the
dialog box is very troubling.

Can someone please point me in the right direction?

Thanks,
RT
 
Hi Robert,

"qryCountExer_CurrYR" sounds like a SourceObject for a
subform ... you need to look up the NAME property and use
that -- better yet, make the Name property the same as the
SourceObject property...after you do that

try

me.qryCountExer_CurrYR.form.requery


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Hi Crystal:

Thanks for taking the time to respond to my question that unfortunately
didn't provide enough details.

You're right, "qryCountExer_CurrYR" is a query used to show my exercise
results for the current year on a sub-form [not a one to many] on a form
built for a flat file table tracking exercise for many years. Based upon the
limited information I provided, how did you know it was a "SourceObject" and
how did you know it was for a subform?

Is there an advantage to making the name property the same as the SoureObject?

Crystal, what's the advantage of changing the query to the one you suggested?

me.qryCountExer_CurrYR.form.requery

I like your suggestions, I'll give them a try and let you know how it works?

RT
 
Hi Crystal:

Your suggestions worked like a charm. Now if you could be so kind as to
explain why those changes were necessary and why it works now, but was
causing that run time error before?

I truly appreciate your help,
RT
 
Hi Robert,

"... how did you know...?"

It was magic :) Seriously, simple deduction:

the error message stated that an object starting with "qry"
couldn't be found -- so I assumed it was a query and the
only way to get a query onto the form is by using a subform.
The SourceObject is what a subform is based on.

A common mistake is to forget the ".form" between a subform
controlname and a reference to one of its propeties or
methods. Another common mistake is to use the SourceObject
or ControlSource instead of the name since that is what is
displayed in the control when you are in design view.

"Is there an advantage to making the name property the same
as the SoureObject?"

I believe that there is -- for bound controls and subforms
-- it avoids confusion and, IMHO, makes the coding easier.
Convention dictates that you name a textbox starting with
"txt", a combobox with "cbo", etc -- I do not like to do
this. Sometimes I may change a control from a textbox to a
combo and do not want to rewrite code because I changed the
type -- and I am a stickler for details.

Also, the important thing in a control is the ControlSource
(for field controls) and SourceObject for a
subform/subreport. I have never had a problem making the
name the same as the source... if anything, it makes things
easier.


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*

Robert said:
Hi Crystal:

Thanks for taking the time to respond to my question that unfortunately
didn't provide enough details.

You're right, "qryCountExer_CurrYR" is a query used to show my exercise
results for the current year on a sub-form [not a one to many] on a form
built for a flat file table tracking exercise for many years. Based upon the
limited information I provided, how did you know it was a "SourceObject" and
how did you know it was for a subform?

Is there an advantage to making the name property the same as the SoureObject?

Crystal, what's the advantage of changing the query to the one you suggested?

me.qryCountExer_CurrYR.form.requery

I like your suggestions, I'll give them a try and let you know how it works?

RT

:

Hi Robert,

"qryCountExer_CurrYR" sounds like a SourceObject for a
subform ... you need to look up the NAME property and use
that -- better yet, make the Name property the same as the
SourceObject property...after you do that

try

me.qryCountExer_CurrYR.form.requery


Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Hi Robert,

you're welcome ;)

the Name of a control is what is used to make a reference to
a control, not the source of it.

When you refer to a subform:

me.subform_controlname

refers to the container that the subform is in -- its
Height, Width, location on the form, SourceObject,
LinkMasterFields, LinkChildFields, etc

me.subform_controlname.form

refers to the subform itself -- its properties, methods, and
the controls (which are actually properties) that are on it.

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Hello Crystal:

You did an excellent job of explaining the logic behind your thought
process. However, there was one comment that wasn't crystal clear to me. You
wrote,

[A common mistake is to forget the ".form" between a subform controlname and
a reference to one of its properties or methods. ]

Could you please explain the above in a little more depth. I noticed in your
revised requery line, you added the word .form before .query to the code. Was
that required?

Thanks so much, you are a wealth of information and I truly appreciate your
sharing it with me and others. By the way, I have another totally unrelated
query question, so let me know when you're ready and I'll post it.

On a totally unrelated note, I tried to rate your answer but could never get
to that option. In addtiion, it it only me or does everyone have a hard time
access this newsgroup? I would guess that lots of people are trying to do
such simultaneously.

Robert
 
Hi Robert,

Thanks :)

As for ratings -- I am sorry, I cannot tell you -- I don't
even know how to look at them because I use newsgroups
through my email program.

[A common mistake is to forget the ".form" between a subform
controlname and a reference to one of its properties or
methods. ]

I explained that in the next post ;)

If you need more explanation, let me know.

Go ahead and post your question in a new thread -- I will
look for you

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*

Robert said:
Hello Crystal:

You did an excellent job of explaining the logic behind your thought
process. However, there was one comment that wasn't crystal clear to me. You
wrote,

[A common mistake is to forget the ".form" between a subform controlname and
a reference to one of its properties or methods. ]

Could you please explain the above in a little more depth. I noticed in your
revised requery line, you added the word .form before .query to the code. Was
that required?

Thanks so much, you are a wealth of information and I truly appreciate your
sharing it with me and others. By the way, I have another totally unrelated
query question, so let me know when you're ready and I'll post it.

On a totally unrelated note, I tried to rate your answer but could never get
to that option. In addtiion, it it only me or does everyone have a hard time
access this newsgroup? I would guess that lots of people are trying to do
such simultaneously.

Robert


:

Hi Robert,

you're welcome ;)

the Name of a control is what is used to make a reference to
a control, not the source of it.

When you refer to a subform:

me.subform_controlname

refers to the container that the subform is in -- its
Height, Width, location on the form, SourceObject,
LinkMasterFields, LinkChildFields, etc

me.subform_controlname.form

refers to the subform itself -- its properties, methods, and
the controls (which are actually properties) that are on it.

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 
Hi Crystal:

I don't see a next message answering my question. I just want to know what
you mean by putting the ".form" between a subform controlname and a
reference to one of its properties or methods.

I'm a veteran of PC databases, I'm just new to Access 2003, so I understood
everything you said except for one little clarification. Are you simply
talking about putting the actual word "form" with a period before and after
it?

I placed my new question about a checkbook balance issue in the
"FormsCoding" forum. Unfortunately I had to update two posts to get the
question formulated correctly.

I couldn't rate your answer in IE, but I can do such using FireFox ,so that
was taken care. One would think it would be the other way around [LOL].

By the way Crystal, what part of the country do you live in?

Thanks again for all of your help.

Robert
 
Hi Robert,

When you refer to a subform:

me.subform_controlname

refers to the container that the subform is in -- its
Height, Width, location on the form, SourceObject,
LinkMasterFields, LinkChildFields, etc

me.subform_controlname.form

refers to the subform itself -- its properties, methods, and
the controls (which are actually properties) that are on it.

I will take a look at your other post in FormsCoding.

I am in Pennsylvania and do consulting -- custom training
over the telephone, as well as programming -- use email and
phone to correspond (my email address is in my siggy).

I use FireFox too -- you will have to tell me how you did
the rating -- it would be interesting to know how to look...

Thanks, Robert

Warm Regards,
Crystal
Microsoft Access MVP 2006

*
Have an awesome day ;)

remote programming and training
strive4peace2006 at yahoo.com

*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top