How Me works?

  • Thread starter mbr96 via AccessMonster.com
  • Start date
M

mbr96 via AccessMonster.com

Form1 has two subforms, one with with recordsource Query1a and the other
recordsource Query1b. I have a button on Form1 that opens Form2. A user
makes choices on Form2, then clicks off a process that creates Query2a and
Query2b dataset, which needs to be shown back on Form1. So I'm trying to
change the recordsources for the two subforms on Form1. I've done this
before but I'm missing something about how "Me" works.

I reopen Form1, change the recordsouces of the subforms, but then the screen
does not yet know that the subform recordsources are different,so I try a

Me.Requery
Me.Refresh

and it says something about the object not being open or that it doesn't
exist. It says this while I'm looking at the "existing, open" object on the
screen. Sometimes computers seem almost as confused as people like me!

It must think I mean another object, not sure how to interpret this. The
form names, subform control names, and recordsources are all spelled
corrrectly, because if I hit F5 (refresh) the screen updates to the correct
Query2a and Query2b recordsources.

Any help? Thanks much.
 
D

Douglas J. Steele

If you're changing the recordsources of the subforms, then it's the subforms
you nbeed to refresh, not the form itself.

Me!NameOfSubformControl.Form.Requery

Note that depending on how the subform was added, the name of the subform
control may be different than the name of the form being used as a subform.
 
G

Gina Whipp

mbr96,

I can't tell by your description which object has the focus but whichever
object has the focus AND if the Me.Requery is in that object then that is
what will get the Requery. If you want object that don't have the focus to
get the Requery you have to *name* them in your statement. Does that help
you understand?

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Form1 has two subforms, one with with recordsource Query1a and the other
recordsource Query1b. I have a button on Form1 that opens Form2. A user
makes choices on Form2, then clicks off a process that creates Query2a and
Query2b dataset, which needs to be shown back on Form1. So I'm trying to
change the recordsources for the two subforms on Form1. I've done this
before but I'm missing something about how "Me" works.

I reopen Form1, change the recordsouces of the subforms, but then the screen
does not yet know that the subform recordsources are different,so I try a

Me.Requery
Me.Refresh

and it says something about the object not being open or that it doesn't
exist. It says this while I'm looking at the "existing, open" object on the
screen. Sometimes computers seem almost as confused as people like me!

It must think I mean another object, not sure how to interpret this. The
form names, subform control names, and recordsources are all spelled
corrrectly, because if I hit F5 (refresh) the screen updates to the correct
Query2a and Query2b recordsources.

Any help? Thanks much.
 
M

mbr96 via AccessMonster.com

Thanks Douglas, this helps my understanding of how to requery the subform
control more specifically with the full Me!Subformcontrol.form.requery. That
looks like a solution - and yes, I have fallen into the trap of the subform
control name being different than the form being used as a subform. Thanks
for mentioning it.

Another response from Gina also educates me, I didn't realize that "Me" has
to do with which object has the focus. Duh. I may work with setting the
focus to the object first, then requerying it. Both seem like valid
approaches.

Thanks a lot!
Matt

If you're changing the recordsources of the subforms, then it's the subforms
you nbeed to refresh, not the form itself.

Me!NameOfSubformControl.Form.Requery

Note that depending on how the subform was added, the name of the subform
control may be different than the name of the form being used as a subform.
Form1 has two subforms, one with with recordsource Query1a and the other
recordsource Query1b. I have a button on Form1 that opens Form2. A user
[quoted text clipped - 22 lines]
Any help? Thanks much.
 
M

mbr96 via AccessMonster.com

Ah! Didn't get the relationship between which object has the focus and which
object has the Me.Requery code. So an object that has the focus and also has
the Me.Requery will get requeried, and I'm thinking about another response
from Douglas, referring more specifically to requerying the subform control.
I can try that way too for better understanding of "Me" and what has the
focus when it fires.

I was really frustrated with a few hours work on this BIG little problem.
Thanks so much!
Matt
 
R

Rick Brandt

Gina said:
mbr96,

I can't tell by your description which object has the focus but whichever
object has the focus AND if the Me.Requery is in that object then that is
what will get the Requery. If you want object that don't have the focus
to
get the Requery you have to *name* them in your statement. Does that help
you understand?

I don't think that is correct. Some of the RunCommand commands act upon the
object that has focus regardless of where the code is running, but
Me.Requery or Me.(AnythingElse) will always act upon the object running the
code. Focus does not matter.
 
G

Gina Whipp

Rick,

My understanding is different... Okay, I have two forms open FormOne and
FormTwo. The Me.Requery is on FormOne but presently FormTwo has the focus.
Unless I tell FormOne to Requery FormTwo, running Me.Requery on FormOne does
nothing for FormTwo. Boy, say that ten times fast! That is what I always
understood, at least that is the way it always appeared to me.

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Gina said:
mbr96,

I can't tell by your description which object has the focus but whichever
object has the focus AND if the Me.Requery is in that object then that is
what will get the Requery. If you want object that don't have the focus
to
get the Requery you have to *name* them in your statement. Does that help
you understand?

I don't think that is correct. Some of the RunCommand commands act upon the
object that has focus regardless of where the code is running, but
Me.Requery or Me.(AnythingElse) will always act upon the object running the
code. Focus does not matter.
 
G

Gina Whipp

Matt,

You are welcome and if you look further down in the thread Rick and I are
debating that...

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Ah! Didn't get the relationship between which object has the focus and
which
object has the Me.Requery code. So an object that has the focus and also
has
the Me.Requery will get requeried, and I'm thinking about another response
from Douglas, referring more specifically to requerying the subform control.
I can try that way too for better understanding of "Me" and what has the
focus when it fires.

I was really frustrated with a few hours work on this BIG little problem.
Thanks so much!
Matt
 
M

mbr96 via AccessMonster.com

Setting aside the focus part (a good topic too), I think we're all in
agreement that "Me" refers to the object from which you are running code.
That seems to be the essence of my problem - I have a Me.Requery in the
second form, intending to requery the data source from the first form.

In your example, what syntax do you use to tell FormOne to requery FormTwo?
Matt

Gina said:
Rick,

My understanding is different... Okay, I have two forms open FormOne and
FormTwo. The Me.Requery is on FormOne but presently FormTwo has the focus.
Unless I tell FormOne to Requery FormTwo, running Me.Requery on FormOne does
nothing for FormTwo. Boy, say that ten times fast! That is what I always
understood, at least that is the way it always appeared to me.

Gina said:
[quoted text clipped - 4 lines]
get the Requery you have to *name* them in your statement. Does that help
you understand?

I don't think that is correct. Some of the RunCommand commands act upon the
object that has focus regardless of where the code is running, but
Me.Requery or Me.(AnythingElse) will always act upon the object running the
code. Focus does not matter.
 
M

mbr96 via AccessMonster.com

Thanks again to both of you, I got this working with a full form reference
from one form to requery the subform control on the other form. I was
thinking that once I had changed the recordsource of an object, that object
was now "Me", but noooooo. Now for some experimentation with focus...

Matt
Setting aside the focus part (a good topic too), I think we're all in
agreement that "Me" refers to the object from which you are running code.
That seems to be the essence of my problem - I have a Me.Requery in the
second form, intending to requery the data source from the first form.

In your example, what syntax do you use to tell FormOne to requery FormTwo?
Matt
[quoted text clipped - 16 lines]
Me.Requery or Me.(AnythingElse) will always act upon the object running the
code. Focus does not matter.
 
G

Gina Whipp

Matt,

From FormOne to FormTwo Requery...

Forms![FromTwo].Requery

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Setting aside the focus part (a good topic too), I think we're all in
agreement that "Me" refers to the object from which you are running code.
That seems to be the essence of my problem - I have a Me.Requery in the
second form, intending to requery the data source from the first form.

In your example, what syntax do you use to tell FormOne to requery FormTwo?
Matt

Gina said:
Rick,

My understanding is different... Okay, I have two forms open FormOne and
FormTwo. The Me.Requery is on FormOne but presently FormTwo has the focus.
Unless I tell FormOne to Requery FormTwo, running Me.Requery on FormOne
does
nothing for FormTwo. Boy, say that ten times fast! That is what I always
understood, at least that is the way it always appeared to me.

Gina said:
[quoted text clipped - 4 lines]
get the Requery you have to *name* them in your statement. Does that
help
you understand?

I don't think that is correct. Some of the RunCommand commands act upon
the
object that has focus regardless of where the code is running, but
Me.Requery or Me.(AnythingElse) will always act upon the object running the
code. Focus does not matter.
 
G

Gina Whipp

Matt,

We'll be waiting if you get stuck!

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Thanks again to both of you, I got this working with a full form reference
from one form to requery the subform control on the other form. I was
thinking that once I had changed the recordsource of an object, that object
was now "Me", but noooooo. Now for some experimentation with focus...

Matt
Setting aside the focus part (a good topic too), I think we're all in
agreement that "Me" refers to the object from which you are running code.
That seems to be the essence of my problem - I have a Me.Requery in the
second form, intending to requery the data source from the first form.

In your example, what syntax do you use to tell FormOne to requery FormTwo?
Matt
[quoted text clipped - 16 lines]
Me.Requery or Me.(AnythingElse) will always act upon the object running
the
code. Focus does not matter.
 
R

Rick Brandt

Gina said:
Rick,

My understanding is different... Okay, I have two forms open FormOne and
FormTwo. The Me.Requery is on FormOne but presently FormTwo has the
focus. Unless I tell FormOne to Requery FormTwo, running Me.Requery on
FormOne does
nothing for FormTwo. Boy, say that ten times fast! That is what I always
understood, at least that is the way it always appeared to me.

That is what I said. "Me" operates on the form where the code is run
without regard to focus. Your original reply seemed to indicate that the
form needed to have focus.

"whichever object has the focus AND if the Me.Requery is in that object then
that is what will get the Requery."

Your statement is correct if you remove the focus part from it.
 
G

Gina Whipp

Rick,

Hmmm, okay I can see how I poorly phrased that!

--
Gina Whipp
2010 Microsoft MVP (Access)

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

Gina said:
Rick,

My understanding is different... Okay, I have two forms open FormOne and
FormTwo. The Me.Requery is on FormOne but presently FormTwo has the
focus. Unless I tell FormOne to Requery FormTwo, running Me.Requery on
FormOne does
nothing for FormTwo. Boy, say that ten times fast! That is what I always
understood, at least that is the way it always appeared to me.

That is what I said. "Me" operates on the form where the code is run
without regard to focus. Your original reply seemed to indicate that the
form needed to have focus.

"whichever object has the focus AND if the Me.Requery is in that object then
that is what will get the Requery."

Your statement is correct if you remove the focus part from it.
 

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

Top