Non existant control source on a form

goldenvision

Board Regular
Joined
Jan 13, 2004
Messages
234
Is it possible to use the visible function to show or hide a none existant control source on a form?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
You have lost me! if it does not exist how can you show it?

Can you give a bit more detail of what is happening and what you are trying to achieve?

Peter
 
Upvote 0
There is a form bound to a crosstab table which will eventually contain 60 fields. It currently contains around 10 the other 50 fields are bound to the control sources that will exist in the future but not at the moment (still with me)
They currently display #Name. I want to hide them so only the text boxes with a valid value are displayed
 
Upvote 0
the only thing that I can think of is to trap the error when you try to read the value. try this code in the Current event of the form. it will probably be possible to add a loop so you dont have to name all 50 fields individualy :)

Code:
Dim xxx As Variable
Dim bolShow As Boolean

bolShow = True
On Error GoTo errorTrap

   xxx = Me.Text20
   Me.Text20.Visible = bolShow
   bolShow = True

Exit Sub

errorTrap:

If Err.number = 2424 Then
   bolShow = False
   Resume Next
End If

Peter
 
Upvote 0

Forum statistics

Threads
1,221,805
Messages
6,162,074
Members
451,738
Latest member
gaseremad

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