需要语法帮助(缺少运算符?) [英] Need help with syntax (missing operator?)

查看:97
本文介绍了需要语法帮助(缺少运算符?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段代码(下面)让我适合。我从网上的其他地方复制了这个代码,我一直在摆弄Where子句中的引用,因为这似乎是问题所在。根据我的更改,我会收到编译错误,语法错误等。


我有一个未绑定的组合框(cboEffDate)。此框的记录源是一个简单查询,显示存储在tblCapacity.EffDate中的有效日期。我想要发生的是让用户从下拉列表中选择一个生效日期,然后让表单上的文本框填充与生效日期关联的字段值。一旦这些字段填充了正确的变量集,就会有一些计算。


错误在where中条款。

此外,字段[EffDate]是表格中的短日期类型。 cboEffDate也是短期日期。


I have a piece of code (below) that is giving me fits. I copied this code from elsewhere on the net, and I have been fiddling with the quotations in the Where clause, as that seems to be the problem. Depending on what I change, I get compile errors, syntax errors, etc.

I have an unbound combo box (cboEffDate). The recordsource for this box is a simple query that shows the effective dates stored in tblCapacity.EffDate. What I want to happen is for the user to select an Effective Date from the drop down, then have my text boxes on the form populate with the field values associated with the effective date. Once those fields are populated with the correct set of variables, there are some calculations.

The error is in the "where" clause.
Also, the field [EffDate] is a short date type in the table. The cboEffDate is also formated for short date.


展开 | 选择 | Wrap | 行号

推荐答案

" WHERE [EffDate] =#" ; &安培; Me.cboEffDate.Value& #"


您需要用#字符包含日期以进行Access查询。
"WHERE [EffDate] = #" & Me.cboEffDate.Value & "#")

You need to enclose dates with the # character for Access queries.


我键入:

" WHERE [EffDate] =#" &安培; Me.cboEffDate.Value& #"


现在我得到运行时3075:

查询表达式中的日期语法错误''EffDate =#''


我想知道我是否有一个额外的空间,我不应该。
I typed:
"WHERE [EffDate] = #" & Me.cboEffDate.Value & "#")

Now I get runtime 3075:
Syntax error in date in query expression ''EffDate = #''

I wonder if I have an extra space somewhere that I should not.


现在我得到一个不同的错误:
Now I am getting a different error:
展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


这篇关于需要语法帮助(缺少运算符?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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