Dynamically change form control value

StuLux

Well-known Member
Joined
Sep 14, 2005
Messages
679
Office Version
  1. 365
Platform
  1. Windows
I'm not sure if I am trying to do something impossible or whether I am approaching the problem in completely the wrong way:

I have a form which is designed to be completed and printed off for signing. There is a sub-form which will detail any risks that are open and I have placed a text box that states that if there are any open risks they will be listed, if there are no risks the sub-form is empty. I would prefer to make this a bit more intuitive and have the text box categorically state when there are no risks and, if there are live risks, how many.

I'm pretty sure I need ot use DCount but can I change the value of a textbox in this way or do I need some other form of control on the form? I didn't really want to store this number anywhere.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi Stuart

Is each risk stored separately within another table? If so, the DCount method will be the way to go. But rather than store the outcome (even if it is zero) in a linked control on your form/report, simply include the DCount as part of a statement to the same effect in an unbound box, e.g.

=IIF(DCount(......)=0, "There are no risks", "There is/are " & DCount(....) & "open risk(s)")

I haven't tested this but have used this technique before with success.

Andrew

More info on DCount here : http://msdn2.microsoft.com/en-us/library/Aa211471(office.11).aspx
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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