输入框对于Where表达式无效? [英] Input Boxes not valid for Where Expressions?
问题描述
我是VB的新手并尝试某些东西(看似非常基本的正常标准)我似乎无法让我的Where表达式从我的输入框中读取值。这就是我所拥有的并且我收到错误说法Microsoft Jet数据库引擎无法识别''x'作为有效的字段名称或表达式
Dim x As整数
Dim y As Integer
strFirstvalue = InputBox(" Enter Starting Value"," Starting Value"," 0")
strSecondvalue = InputBox(输入结束价值,结束价值,100)
x = strFirstvalue
y = strSecondvalue
DoCmd.OpenReportMTBF,acViewPreview ,,"[序列号]在x和y之间,acWindowNormal,"
任何简单的修复?
I''m new to VB and attempting something (seemingly very very basic by normal standards) and I can not seem to get my Where expression to read values from my inputbox. This is what i have and i am recieving an error sayings "The Microsoft Jet Database engine does not recognize ''x'' as a valid field name or expression"
Dim x As Integer
Dim y As Integer
strFirstvalue = InputBox("Enter Starting Value", "Starting Value", "0")
strSecondvalue = InputBox("Enter Ending Value", "Ending Value", "100")
x = strFirstvalue
y = strSecondvalue
DoCmd.OpenReport "MTBF", acViewPreview, , "[Serial Number] Between x and y", acWindowNormal, " "
any simple fixes?
推荐答案
我是VB新手并尝试某些东西(看似非常基本的正常标准)我似乎无法让我的Where表达式从我的输入框中读取值。这就是我所拥有的并且我收到错误说法Microsoft Jet数据库引擎无法识别''x'作为有效的字段名称或表达式
Dim x As整数
Dim y As Integer
strFirstvalue = InputBox(" Enter Starting Value"," Starting Value"," 0")
strSecondvalue = InputBox(输入结束价值,结束价值,100)
x = strFirstvalue
y = strSecondvalue
DoCmd.OpenReportMTBF,acViewPreview ,,"[序列号]在x和y之间,acWindowNormal,"
任何简单的修复?
I''m new to VB and attempting something (seemingly very very basic by normal standards) and I can not seem to get my Where expression to read values from my inputbox. This is what i have and i am recieving an error sayings "The Microsoft Jet Database engine does not recognize ''x'' as a valid field name or expression"
Dim x As Integer
Dim y As Integer
strFirstvalue = InputBox("Enter Starting Value", "Starting Value", "0")
strSecondvalue = InputBox("Enter Ending Value", "Ending Value", "100")
x = strFirstvalue
y = strSecondvalue
DoCmd.OpenReport "MTBF", acViewPreview, , "[Serial Number] Between x and y", acWindowNormal, " "
any simple fixes?
是的,使用Val函数将x和y从字符串转换为数字,如下所示:
x = Val(strFirstvalue )
y = Val(strSecondvalue)
Yes, use the Val function to convert x and y from string to numeric as shown:
x = Val(strFirstvalue)
y = Val(strSecondvalue)
我尝试了将x作为val的所有不同方法,使用字符串的val并且都返回了确切的结果同样的错误。我刚尝试了你的x = Val(等等)的想法,它又回来说x不是有效的字段或表达式
我不理解它,因为当我输入的值就像20和30而不是x和y它理解并运行where表达式,x = Val如何不仅仅是一个常数中的类型
I''ve tried all different ways of putting x as a val, using val of the string and all return the exact same error. I just attempted your idea of x = Val( etc.) and it again returned that x isn''t a valid field or expression
I dont understand it because when i just enter values like 20 and 30 instead of x and y it comprehends and runs the where expression, how is x=Val any different than just a typed in constant number
我已经尝试了将x作为val的所有不同方法,使用字符串的val并且都返回完全相同的错误。我刚刚尝试了你的想法x = Val(等等),它再次返回x不是有效字段或表达式
I''ve tried all different ways of putting x as a val, using val of the string and all return the exact same error. I just attempted your idea of x = Val( etc.) and it again returned that x isn''t a valid field or expression
检查输入的返回值框。它显示了什么?
Check the return value from your input box. What does it show?
这篇关于输入框对于Where表达式无效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!