查询从文本框中检索错误的数据? [英] Query retrieving wrong data from text box?

查看:55
本文介绍了查询从文本框中检索错误的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有


我在Access 2000和2003上遇到了同样的问题。


希望有人可以复制它吗?是不是。


1.创建一个未绑定的表单?称之为Form1。


2.插入两个未绑定的文本框?称之为Text0和Text2。


3.运行表格并在两个文本框中输入一些数据。


4.表格是仍然加载,创建一个从这些文本框中检索数据的查询。

设计视图中的查询语句必须是:

Expr1:[Forms]![Form1 ]![Text0]



Expr2:[表格]![Form1]![Text2]


5.运行查询(它应该检索你输入到两个文本框中的数据)。


6.现在回到设计视图中的表单并将Text2的格式更改为?Short Date ? (或您喜欢的任何其他格式)。


7.运行表格并在两个文本框中输入一些新数据。


8。当表单仍然加载时,运行查询。


9.现在查询的Expr2返回乱码,而Expr1仍能正常工作。 (将Text2的格式改回其他东西也没有用。)


如果我使用会出现同样的问题吗?[Forms]![FormName]![ControlName]?从绑定文本框中检索数据 - 如果它绑定到格式为短日期的字段?或?长日期?但是如果文本框绑定到格式化为文本的字段,我不会收到错误。


有什么建议吗?

Hi, all

I run into the same problem on Access 2000 and 2003.

Hopefully someone can replicate it ? or not.

1. Create an unbound form ? call it Form1.

2. Insert two unbound text boxes ? call it Text0 and Text2.

3. Run the form and enter some data in both text boxes.

4. While the form is still loaded, create a query that retrieves the data from these text boxes.
The query?s statements in design view must be:
Expr1: [Forms]![Form1]![Text0]
and
Expr2: [Forms]![Form1]![Text2]

5. Run the query (it should retrieve the data you entered into the two text boxes).

6. Now go back to the form in design view and change the format of Text2 to ?Short Date? (or any other format you like).

7. Run the form and enter some new data in both text boxes.

8. While the form is still loaded, run the query.

9. Now the query?s Expr2 returns garble, while Expr1 still works fine. (It also does not help to change Text2?s format back to something else).

The same problem occurs if I use ?[Forms]![FormName]![ControlName]? to retrieve data from a bound text box - if it is bound to a field which is formatted as ?Short Date? or ?Long Date?. But I do not get an error if the text box is bound to a field which is formatted as text.

Any advice?

推荐答案

我无法看到如何从表单的on load事件中的未绑定控件中检索数据。
I can''t see how you can retrieve data from an unbound control in the on load event of the form.


不,查询不需要处于加载状态事件。在文本框中输入数据后,可以添加命令按钮来运行查询。
No, the query need not be in the on load event. You can add a command button to run the query after you entered data into the text boxes.



不,查询不需要在on load事件。在数据输入文本框后,可以添加命令按钮来运行查询。
No, the query need not be in the on load event. You can add a command button to run the query after you entered data into the text boxes.



发布正在运行的查询的SQL。


根据文本框中的值运行查询表格必须打开。


Mary

Post the SQL of the query you are running.

To run a query based on the values in a textbox on a form the form must be open.

Mary


这篇关于查询从文本框中检索错误的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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