Master/Child results in "This expression is typed incorrectly, or it is too complex to be evaluated..."

ARW17

Board Regular
Joined
Oct 31, 2016
Messages
109
I'm trying to make the master a text box called 'TxtTab' and the child a text box from my subform: 'Forecast Date'.

I wrote some VBA code to make the 'TxtTab' text box equal the caption on my tabs. I want to be able to flip through my tabs and have the data update based on the date in the tab.

I'm not sure if I'm doing something wrong or if the way I have it set up is too complex...
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
It was because I formatted the dates on the tabs with Format([], "ddd mm/yy" and it recognized this as text. I have another date at the top of my form that is formatted as a date and I set the text box to refer to it instead of to the tabs themselves.

Private Sub DayTabs_Click()
'Change Text to equal the tab in order to set Master/Child.
If DayTabs.Pages(DayTabs.Value).Name = "Today" Then
txtTab = TxtBxDate
End If
If DayTabs.Pages(DayTabs.Value).Name = "TodayPlus1" Then
txtTab = DateAdd("w", 1, [TxtBxDate])
End If
If DayTabs.Pages(DayTabs.Value).Name = "TodayPlus2" Then
txtTab = DateAdd("w", 2, [TxtBxDate])
End If
If DayTabs.Pages(DayTabs.Value).Name = "TodayPlus3" Then
txtTab = DateAdd("w", 3, [TxtBxDate])
End If
If DayTabs.Pages(DayTabs.Value).Name = "TodayPlus4" Then
txtTab = DateAdd("w", 4, [TxtBxDate])
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,770
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top