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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Text box to display name of current active tab returning #Name?



 
 
Thread Tools Display Modes
  #1  
Old May 4th, 2009, 08:44 PM posted to microsoft.public.access
Clddleopard
external usenet poster
 
Posts: 59
Default Text box to display name of current active tab returning #Name?

I have a tab control on a form with a form showing through behind it. The
query for the form refreshes when switching tabs and is supposed to use the
name of the active tab as one of the criteria for the query. I do this by
referencing a text box on the form named "tab" that has the following set as
its control source:
=[TabCtl0].[Pages]([TabCtl0]).[Name]

I swear that at one point this used to work, but now I get #Name? instead
of the tab's name in the text box, which obviously screws up my query. Any
idea why this would stop working?

Hope it's something simple!
  #2  
Old May 4th, 2009, 11:05 PM posted to microsoft.public.access
[email protected]
external usenet poster
 
Posts: 129
Default Text box to display name of current active tab returning #Name?

I'm surprised you are getting the error; I'd have thought it more
likely that the text box's value would stick at the name of tab
control's default page.

As you are presumably requerying the form in the tab control's Change
event procedure you can 'push' the value into the text box in the
procedu

Dim ctrl As Control

Set ctrl = Me.TabCtl0

Me.YourTextBox = ctrl.Pages(ctrl).Name
Me.Requery

Leave the text box's ControlSource property blank. You'd need to
execute the same code in the form's open event procedure to initialize
the value of the text box, so it would be better to wrap the code in a
function in the form's module and call the function as each of the
event properties rather than repeating the code.

Ken Sheridan
Stafford, England

On May 4, 8:44 pm, Clddleopard
wrote:
I have a tab control on a form with a form showing through behind it. The
query for the form refreshes when switching tabs and is supposed to use the
name of the active tab as one of the criteria for the query. I do this by
referencing a text box on the form named "tab" that has the following set as
its control source:
=[TabCtl0].[Pages]([TabCtl0]).[Name]

I swear that at one point this used to work, but now I get #Name? instead
of the tab's name in the text box, which obviously screws up my query. Any
idea why this would stop working?

Hope it's something simple!


  #3  
Old May 4th, 2009, 11:43 PM posted to microsoft.public.access
Clddleopard
external usenet poster
 
Posts: 59
Default Text box to display name of current active tab returning #Name

Great, that worked. Thanks a lot!
I was also surprised that I was getting the #name? error instead of just
having the text box stick to one. When it was working though, it did change
the text box when I changed tabs. Not sure what caused it to stop working
initially...

" wrote:

I'm surprised you are getting the error; I'd have thought it more
likely that the text box's value would stick at the name of tab
control's default page.

As you are presumably requerying the form in the tab control's Change
event procedure you can 'push' the value into the text box in the
procedu

Dim ctrl As Control

Set ctrl = Me.TabCtl0

Me.YourTextBox = ctrl.Pages(ctrl).Name
Me.Requery

Leave the text box's ControlSource property blank. You'd need to
execute the same code in the form's open event procedure to initialize
the value of the text box, so it would be better to wrap the code in a
function in the form's module and call the function as each of the
event properties rather than repeating the code.

Ken Sheridan
Stafford, England

On May 4, 8:44 pm, Clddleopard
wrote:
I have a tab control on a form with a form showing through behind it. The
query for the form refreshes when switching tabs and is supposed to use the
name of the active tab as one of the criteria for the query. I do this by
referencing a text box on the form named "tab" that has the following set as
its control source:
=[TabCtl0].[Pages]([TabCtl0]).[Name]

I swear that at one point this used to work, but now I get #Name? instead
of the tab's name in the text box, which obviously screws up my query. Any
idea why this would stop working?

Hope it's something simple!



 




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 03:34 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.