Splitting a Text Field and uusing the data to change field properties

markblake

New Member
Joined
Jun 19, 2017
Messages
1
Hello Guys,

I have a table with 20 records. I have a form that has 6 fields on it and depending on what record is selected determines the number of fields that are use.


For instance,


Type NbrConnections CallOuts


Elbow 2 1,3
Tee 3 1,2,3
Tapped Tee 4 1,2,3,6


I can probably nest 20 If statements to evaluate the "Type" field on the form and than tell it which of the 6 fields to make visible, however I was looking for a simpler solution.


I thought perhaps there was a way to use the text in the CallOuts fields to create the necessary VBA statements to change the field properties ie


Elbow 1,3
Split 1,3 into 1 and 3
Combine to create fields names "textbox"&"1" and "textbox"&"2"
Now set the properties for textbox1.visible and textbox2.visible


Thanks


I didn't find the right solution from the internet.
References:
- Splitting a Text Field and uusing the data to change field properties
advertising link removed
 
Last edited by a moderator:

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
If it was more than 20, or likely to get more than 20, then I would be thinking like you are, but with the data normalised, so 1 & 3 would be records. Then you would walk through the records and change the visible property for control1 and control3.
You could still do that, but it would be a little harder to do. You could look at the Split function?
I do not gave the syntax to hand but have seen examples where controls are just numbered numerically and then use the data to identify which one. I *think* the evaluate function might be used?

HTH

Anyway I would think of using the Select Case statement and not IF?

Edit:
Seems you have already been given a viable solution to the problem?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,687
Messages
6,161,287
Members
451,695
Latest member
Doug Mize 1024

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