数据无法保存到现场 [英] Data can't be saved to the field

查看:94
本文介绍了数据无法保存到现场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。


BeforeUpdate代码:

Me!cboFoo.Text = UCase(Me!cboFoo.Text)


我收到错误:


运行时错误''2115'':


设置为的宏或函数BeforeUpdate或ValidationRule
此字段的
属性阻止Microsoft Access保存字段中的数据


为什么这样?


-

Georges

Hi.

BeforeUpdate code:
Me!cboFoo.Text = UCase(Me!cboFoo.Text)

I get the error:

Run-time error ''2115'':

The macro or function set to the BeforeUpdate or ValidationRule
property for this field is preventing Microsoft Access from saving
the data in the field.

Why is that?

--
Georges

推荐答案

I ''我不知道为什么,但是在
BeforeUpdate期间,Access不会让你更改控件的内容。我的解决方法一直是在

AfterUpdate处理程序中做这种。你不可能在那里使用.Text属性,所以

只使用该值,并检查Null。顺便说一句,既然你在这里描述了一个

组合框,那么该值应该自动转换为相同的大小

作为匹配的选择,没有任何代码。


无论如何,如果它是一个文本框,这是我如何做的一个例子...


Private Sub txtFoo_AfterUpdate( )

If IsNull(Me!txtFoo)然后退出Sub

Me!txtFoo = UCase(Me!txtFoo)

End Sub

2003年12月10日星期三01:41:05 +0100,Georges Heinesch< ne ** @ geohei.lu>写道:
I''m not sure why, but Access won''t let you change a control''s contents during
BeforeUpdate. My work-around has always been to do this sort of thin in the
AfterUpdate handler. You won''t be able to use the .Text property there, so
just use the value, and check for Null. By the way, since you''re describing a
combo box here, the value should automatically be converted to the same case
as the matching selection with no code whatsoever.

Anyway, if it were a text box, this is an exaple of how I would do it...

Private Sub txtFoo_AfterUpdate()
If IsNull(Me!txtFoo) Then Exit Sub
Me!txtFoo = UCase(Me!txtFoo)
End Sub
On Wed, 10 Dec 2003 01:41:05 +0100, Georges Heinesch <ne**@geohei.lu> wrote:
嗨。

BeforeUpdate代码:
我!cboFoo.Text = UCase(Me!cboFoo.Text)
<我得到错误:

运行时错误''2115'':

设置为BeforeUpdate或ValidationRule
属性的宏或函数此字段阻止Microsoft Access保存现场数据。

为什么会这样?
Hi.

BeforeUpdate code:
Me!cboFoo.Text = UCase(Me!cboFoo.Text)

I get the error:

Run-time error ''2115'':

The macro or function set to the BeforeUpdate or ValidationRule
property for this field is preventing Microsoft Access from saving
the data in the field.

Why is that?






Steve Jorgensen写道:
Steve Jorgensen wrote:
我不知道为什么,但Access不会让你在
BeforeUpdate期间更改控件的内容。我的解决方法一直是在AfterUpdate处理程序中做这种瘦身。你不能在那里使用.Text属性,所以
只需使用该值,并检查Null。


这个有效,但是......(见下文)

顺便说一下,既然你在这里描述了一个
组合框,该值应自动转换为相同的情况
作为匹配选择,无任何代码。


如果是自动展开设置为是。但是在我的一个控件中它不是。

无论如何,如果它是一个文本框,这是我如何做到的一个例子......

Private Sub txtFoo_AfterUpdate()
如果IsNull(Me!txtFoo)然后退出Sub
Me!txtFoo = UCase(Me!txtFoo)
End Sub
I''m not sure why, but Access won''t let you change a control''s contents during
BeforeUpdate. My work-around has always been to do this sort of thin in the
AfterUpdate handler. You won''t be able to use the .Text property there, so
just use the value, and check for Null.
This works, but ... (see below)
By the way, since you''re describing a
combo box here, the value should automatically be converted to the same case
as the matching selection with no code whatsoever.
In case the "Auto Expand" is set to Yes. But in one of my controls it''s not.
Anyway, if it were a text box, this is an exaple of how I would do it...

Private Sub txtFoo_AfterUpdate()
If IsNull(Me!txtFoo) Then Exit Sub
Me!txtFoo = UCase(Me!txtFoo)
End Sub



是的,工作。最好,我希望输入的字母在从小写到大写的输入时已经转换为

。 I.o.w.,所有

输入的字母(也是小写)应该显示为大写。我用面具(> aaaa)试了一下

。令我惊讶的是,我看到将自动展开

的ComboBox设置为是,文本在第一个字母输入

时结束。


我解释:


ComboBox选项:

ABCD

EFGH
IJKL


没有面具:

ABCD(BCD倒置)

第二个输入的信件是追求A


带面具:

A ABCD

全部4个字母ABCD已经完成


后一种行为不是必需的。我怎样才能使用面具并制作

Access的行为与第一种情况相似(没有面具)?


TIA


-

Georges



Yep, working. Preferntially, I would like to have the entered letters be
converted already upon input from lowercase to uppercase. I.o.w., all
entered letters (also lowercase) should show up as uppercase. I tried it
with a mask (>aaaa). To my great surprise, I saw that with "Auto Expand"
of a ComboBox set to Yes, the text completes to the end when entering
the first letter.

I explain:

ComboBox options:
ABCD
EFGH
IJKL

Without the mask:
A ABCD (BCD inverted)
The second entered letter goes after the A

With the mask:
A ABCD
The entire 4 letters "ABCD" are already completed

The latter behaviour is not required. How can I use a mask and make
Access behave like for the first situation (without a mask)?

TIA

--
Georges


Georges,
Georges,
是的,工作。最好,我希望输入的字母在从小写到大写的输入时已经转换。 I.o.w.,所有
输入的字母(也是小写)应显示为大写。我用面具(> aaaa)尝试了它。令我惊讶的是,我看到将ComboBox的自动扩展设置为是时,文本在输入第一个字母时就完成了。
Yep, working. Preferntially, I would like to have the entered letters be
converted already upon input from lowercase to uppercase. I.o.w., all
entered letters (also lowercase) should show up as uppercase. I tried it
with a mask (>aaaa). To my great surprise, I saw that with "Auto Expand"
of a ComboBox set to Yes, the text completes to the end when entering
the first letter.




输入时使用Change-event转换为UpperCase:

Me!cboName.text = UCase(Me!cboName.text)

-

希望这有帮助

Arno R



Use the Change-event to convert to UpperCase upon input.:
Me!cboName.text=UCase(Me!cboName.text)
--
Hope this helps
Arno R


这篇关于数据无法保存到现场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆