(错误 3071)访问
我试图通过检查课程表中的教员 ID 和课程 ID 来搜索课程 ID。它是一个简单的查询,但启动时我收到一个
(此表达式键入不正确,或者它太复杂而无法计算。例如,数字表达式可能包含太多复杂的元素。尝试通过将表达式的一部分分配给来简化表达式(错误 3071)
我使用的 VB 脚本如下所示。
Private Sub Course_ID_DblClick(Cancel As Integer)
Dim x As Integer
Dim y As String
Dim z As Integer
x = Me.Faculty_ID.Value
Me.Course_ID.RowSource = "SELECT Course.[Course ID] FROM Course WHERE Course.[Course Name]=['Course']AND Course.[Faculty ID]='" & x & "'"
End Sub
I'm trying to search for the Course ID by checking the the faculty ID and Course ID in my Course table. Its a simple query but when launched I receive a
(This expression is typed incorrectly, or it is too complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables. (Error 3071)
The VB script I'm using looks like this.
Private Sub Course_ID_DblClick(Cancel As Integer)
Dim x As Integer
Dim y As String
Dim z As Integer
x = Me.Faculty_ID.Value
Me.Course_ID.RowSource = "SELECT Course.[Course ID] FROM Course WHERE Course.[Course Name]=['Course']AND Course.[Faculty ID]='" & x & "'"
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您收到此消息是因为您在对象名称中使用了错误的分隔符和令人困惑的术语(其中字段内容“course”和表名称 [course] 相同。
我猜您的数据源是 ms-access 数据库。然后您应该使用“(双引号)作为文本的值分隔符(您必须将表达式内的符号加倍),而对于数字则不使用任何内容。您的选择指令可能如下所示:
添加 'debug.print Me.Course_ID.RowSource ' 检查最终的字符串应如下所示:
I think you are getting this message because you are using wrong delimiters and confusing terminology in object names (where field content 'course' and table name [course] are the same.
I guess your datasource is an ms-access database. You should then use the " (double quote) as value separator (you'll have to double the sign inside the expression) for text, and nothing for numbers. your select instruction could then look like:
Add a 'debug.print Me.Course_ID.RowSource' to check the final string that should look like:
字符串文字周围不应有括号:
此外,您可以在访问查询中使用单引号或双引号作为字符串分隔符。
There should be no brackets around your string literals:
Also, you can use either single or double quotes as string delimiters in an access query.