A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How Me works?



 
 
Thread Tools Display Modes
  #1  
Old January 30th, 2010, 08:39 PM posted to microsoft.public.access.forms
mbr96 via AccessMonster.com
external usenet poster
 
Posts: 37
Default How Me works?

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.

--
Message posted via http://www.accessmonster.com

  #2  
Old January 30th, 2010, 09:13 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default How Me works?

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.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"mbr96 via AccessMonster.com" u8822@uwe wrote in message
news:a2e667ec87009@uwe...
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.

--
Message posted via http://www.accessmonster.com



  #3  
Old January 30th, 2010, 09:16 PM posted to microsoft.public.access.forms
Gina Whipp
external usenet poster
 
Posts: 3,500
Default How Me works?

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

"mbr96 via AccessMonster.com" u8822@uwe wrote in message
news:a2e667ec87009@uwe...
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.

--
Message posted via http://www.accessmonster.com


  #4  
Old January 30th, 2010, 09:56 PM posted to microsoft.public.access.forms
mbr96 via AccessMonster.com
external usenet poster
 
Posts: 37
Default How Me works?

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


Douglas J. Steele wrote:
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.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #5  
Old January 30th, 2010, 10:00 PM posted to microsoft.public.access.forms
mbr96 via AccessMonster.com
external usenet poster
 
Posts: 37
Default How Me works?

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

Gina Whipp wrote:
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?

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.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #6  
Old January 30th, 2010, 10:05 PM posted to microsoft.public.access.forms
Rick Brandt
external usenet poster
 
Posts: 4,354
Default How Me works?

Gina Whipp wrote:

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.


  #7  
Old January 30th, 2010, 10:18 PM posted to microsoft.public.access.forms
Gina Whipp
external usenet poster
 
Posts: 3,500
Default How Me works?

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

"Rick Brandt" wrote in message
...
Gina Whipp wrote:

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.



  #8  
Old January 30th, 2010, 10:20 PM posted to microsoft.public.access.forms
Gina Whipp
external usenet poster
 
Posts: 3,500
Default How Me works?

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

"mbr96 via AccessMonster.com" u8822@uwe wrote in message
news:a2e71e1dacf8f@uwe...
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

Gina Whipp wrote:
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?

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.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1


  #9  
Old January 30th, 2010, 10:42 PM posted to microsoft.public.access.forms
mbr96 via AccessMonster.com
external usenet poster
 
Posts: 37
Default How Me works?

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 Whipp wrote:
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 wrote:

mbr96,

[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.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

  #10  
Old January 30th, 2010, 11:05 PM posted to microsoft.public.access.forms
mbr96 via AccessMonster.com
external usenet poster
 
Posts: 37
Default How Me works?

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

mbr96 wrote:
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

Rick,

[quoted text clipped - 16 lines]
Me.Requery or Me.(AnythingElse) will always act upon the object running the
code. Focus does not matter.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201001/1

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:47 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.