vba Microsoft Access 错误:“由于您的安全设置和当前的安全策略,此控件已禁用”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9916003/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 15:41:22  来源:igfitidea点击:

Microsoft Access error: "Because of your security settings and current security policy, this control is disabled"

sql-serverms-accessvba

提问by skub

Hi guys I am getting an issue with a access 2007 application that I am working on. Access acts as a front end for a SQL server 2005 backend. When I try to click on a richtext control on the form, it gives me the following error:

大家好,我正在处理的 Access 2007 应用程序出现问题。Access 充当 SQL Server 2005 后端的前端。当我尝试单击表单上的富文本控件时,它给了我以下错误:

Because of your security settings and current security policy, this control is disabled. To modify your policy and enable the database, use the message bar.

由于您的安全设置和当前的安全策略,此控制被禁用。要修改您的策略并启用数据库,请使用消息栏。

After a bit of searching, the suggestiong is to add a trusted location, however this error still comes up. Could someone please help?

经过一番搜索,建议是添加一个受信任的位置,但是仍然出现此错误。有人可以帮忙吗?

Many thanks.

非常感谢。

采纳答案by skub

Ok so I found out the cause of this issue after a lot of trial and error. It seems that the rich text box control has limited support in Access 2007. I found out that the rich text box I am using is Microsoft Microsoft Rich Textbox Control 6.0 (SP4)- RichTX32.OCX. Apparently it will cause the above error if activeX is disabled.

好的,经过大量试验和错误,我找到了导致此问题的原因。似乎富文本框控件在Access 2007 中的支持有限。我发现我使用的富文本框是Microsoft Microsoft Rich Textbox Control 6.0 (SP4)- RichTX32.OCX。显然如果 activeX 被禁用,它会导致上述错误。

To fix this I modified my registry entries as follows (although this opens up security issues with IE aswell):

为了解决这个问题,我按如下方式修改了我的注册表项(尽管这也会引发 IE 的安全问题):

  1. Open up regedit
  2. Go to the following key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility{3B7C8860- D78F-101B-B9B5-04021C009402}

  3. There should be a DWORD called Compatiblity Flags. Set this to 0 (default is hexadecimal 400)

  1. 打开注册表
  2. 转到以下键:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX 兼容性{3B7C8860-D78F-101B-B9B5-04021C009402}

  3. 应该有一个 DWORD 称为Compatiblity Flags。将此设置为 0(默认为十六进制 400)

Some additional information that I found useful follows:

我发现有用的一些附加信息如下:

回答by CodeLurker

I recently found this ?, and started updating the control to work. Then, I came across the right way to get rich text in a form in MSO 2007+:

我最近发现了这个?,并开始更新控件以使其正常工作。然后,我遇到了在 MSO 2007+ 中以一种形式获取富文本的正确方法:

Insert or add a rich text field

插入或添加富文本字段

It says you need to have a memo field in a table, and set its text format to Rich Text. Since the solution is a bit opaque, I'll continue with what worked for me: I then go into form design, and create a text field. I set its data source to the table's rich text memo field; and its "Text Format" property to "Rich Text". I set its "Scroll Bars" property to "Vertical".

它说您需要在表格中有一个备注字段,并将其文本格式设置为富文本。由于解决方案有点不透明,我将继续使用对我有用的方法:然后进入表单设计,并创建一个文本字段。我将其数据源设置为表格的富文本备注字段;并将其“文本格式”属性设置为“富文本”。我将其“滚动条”属性设置为“垂直”。

Now, I get some nice text formatting options in Access 2010; but it's kinda stupid the way they've implemented them. There's no format painter. Also, if I want to e.g. set the font to Times New Roman to pitch 11, it doesn't let me; but makes turns it into 10; although I can select 12 also - but not 11. If, however, in Design View, I set it the field's font to "Times New Roman", and set the font size THERE to 11, the font is size 11 by default. I can paste things into it in 11 pitch, by first pasting them into Notepad, to strip them of their formatting attributes, and then from Notepad into my field, to get pitch 11 text; or I can paste pitch 11 from elsewhere.

现在,我在 Access 2010 中获得了一些不错的文本格式选项;但他们实施它们的方式有点愚蠢。没有格式画家。另外,如果我想将字体设置为 Times New Roman 到 11,它不允许我;但 make 将其变成 10;虽然我也可以选择 12 - 但不能选择 11。但是,如果在设计视图中,我将字段的字体设置为“Times New Roman”,并将字体大小设置为 11,则默认情况下字体大小为 11。我可以将内容以 11 间距粘贴到其中,首先将它们粘贴到记事本中,去除它们的格式属性,然后从记事本中将其粘贴到我的字段中,以获得间距 11 的文本;或者我可以从其他地方粘贴间距 11。

This has the advantage of getting some handy text formatting controls to light up on your home ribbon, and lets you format stuff more or less properly.

这样做的好处是可以让一些方便的文本格式控件在您的家庭功能区上亮起,并让您或多或少正确地格式化内容。