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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|