I'm making an InfoPath form which is tied to an Access database. I have a set of radio buttons where the user selects the software name corresponding to the form, but I store this in my database as a number (1, 2, or 3). In another view, I want them to be able to see the previously entered software name, but not be able to change this. Here are the two options I've thought of:
我正在制作一个与Access数据库绑定的InfoPath表单。我有一组单选按钮,用户选择与表单对应的软件名称,但我将其作为数字(1,2或3)存储在我的数据库中。在另一个视图中,我希望他们能够看到以前输入的软件名称,但无法更改此名称。以下是我想到的两个选项:
-
Create some rule that does prevents the user from changing this data
创建一些阻止用户更改此数据的规则
This seems like the natural approach for what I want to do.
这似乎是我想要做的自然方法。
-
Add a text field with a function mapping each number to the corresponding software
添加一个文本字段,其中包含将每个数字映射到相应软件的函数
As the form is tied to the database, InfoPath wants all fields to be tied to a database value, which would require creating another database entry. I'm also having trouble finding an InfoPath function I can use to handle this mapping.
由于表单与数据库绑定,因此InfoPath希望将所有字段绑定到数据库值,这需要创建另一个数据库条目。我也找不到可以用来处理这个映射的InfoPath函数。
-
Change the radio box's variable to text values and make a text box in the new view, which can be made read-only.
将单选框的变量更改为文本值,并在新视图中创建一个文本框,该文本框可以设置为只读。
I'd really prefer not to do this, as it will make things messier for other programs using this database value and seems wasteful, but if nothing else works, this seems do-able.
我真的不想这样做,因为它会使使用这个数据库值的其他程序变得更加混乱并且看起来很浪费,但是如果没有其他工作,那么这似乎是可行的。
Is there some sort of rule/method I could use to make this radio button control read-only?
是否有某种规则/方法可以用来使这个单选按钮控制为只读?
1 个解决方案
#1
You can use conditional formatting to disable any control (including radio buttons). To set your control to always be disabled do the following:
您可以使用条件格式来禁用任何控件(包括单选按钮)。要将控件设置为始终禁用,请执行以下操作:
- Right click on your control and select Conditional Formatting...
- Click Add...
- In the leftmost dropdown select The expression
- type true() in the text field (this tells InfoPath to always apply this formatting)
- Check the Disable this control checkbox.
- Click OK and OK.
右键单击您的控件,然后选择条件格式...
在最左边的下拉列表中选择表达式
在文本字段中键入true()(这告诉InfoPath始终应用此格式)
选中“禁用此控件”复选框。
单击确定然后单击确定
Note: You will need to do this for each of your radio buttons.
注意:您需要为每个单选按钮执行此操作。
Also, for future reference: If you simply want to display the result of a function (such as in your second solution) you don't need to use a text box. You can use an expression box. An expression box is not necessarily linked to a field in the datasorce, so you won't need an additional column in your database for it.
此外,为了将来参考:如果您只想显示函数的结果(例如在第二个解决方案中),则不需要使用文本框。您可以使用表达式框。表达式框不一定链接到datasorce中的字段,因此您不需要在数据库中添加其他列。
#1
You can use conditional formatting to disable any control (including radio buttons). To set your control to always be disabled do the following:
您可以使用条件格式来禁用任何控件(包括单选按钮)。要将控件设置为始终禁用,请执行以下操作:
- Right click on your control and select Conditional Formatting...
- Click Add...
- In the leftmost dropdown select The expression
- type true() in the text field (this tells InfoPath to always apply this formatting)
- Check the Disable this control checkbox.
- Click OK and OK.
右键单击您的控件,然后选择条件格式...
在最左边的下拉列表中选择表达式
在文本字段中键入true()(这告诉InfoPath始终应用此格式)
选中“禁用此控件”复选框。
单击确定然后单击确定
Note: You will need to do this for each of your radio buttons.
注意:您需要为每个单选按钮执行此操作。
Also, for future reference: If you simply want to display the result of a function (such as in your second solution) you don't need to use a text box. You can use an expression box. An expression box is not necessarily linked to a field in the datasorce, so you won't need an additional column in your database for it.
此外,为了将来参考:如果您只想显示函数的结果(例如在第二个解决方案中),则不需要使用文本框。您可以使用表达式框。表达式框不一定链接到datasorce中的字段,因此您不需要在数据库中添加其他列。