问题描述
有没有理由我继续得到这个运行时错误,我从来没有
之前得到它。有人可以帮我解决这个问题吗?这是我的代码:
rstout
''首先检查是否不在EOF
如果不是(rstin.EOF)然后
rstin.MoveFirst
''循环遍历所有记录rstIN(表tblPhongParseIN)
做的时候没有rstin.EOF
''将strField1设置为tblPhongParseIN Field1
strField1 = rstin(" ID")
cutstring = Left([strField1],InStr([strField1], "") -
1)< ------这是我收到错误的地方。
strfield4 = rstin(" amt_issued")
谢谢你。
Is there a reason why i keep getting this run time error, i never
gotten it before. Can someone help me out with this? here is my code:
With rstout
''first check if not on EOF
If Not (rstin.EOF) Then
rstin.MoveFirst
''loop through all the records rstIN (table tblPhongParseIN)
Do While Not rstin.EOF
''set strField1 to tblPhongParseIN Field1
strField1 = rstin("ID")
cutstring = Left([strField1], InStr([strField1], " ") -
1)<------This is where i get the error.
strfield4 = rstin("amt_issued")
THank you.
推荐答案
Phong,
当我尝试MsgBox时(左(我的文字,-1)),我收到错误信息5.
似乎暗示 "在[strField1]中找不到导致
-1出现在Length参数中。另外,假设strField1是声明为字符串的
,那么
周围不应该有任何方括号。也许Access正在寻找Me.strField1,因为方括号
括号。无论如何,MsgBox(*& strField1&" *")看它是否包含
空白与否。我也不明白为什么你需要一个 "在
''ID'字段中。或许使用If..Then..Else是否
InStr(strField1,"")= 0.
James A. Fortune
Phong,
When I try MsgBox (Left("My Text", -1)), I get error message 5. That
seems to suggest that " " is not being found in [strField1] causing a
-1 to show up in the Length argument. Also, assuming strField1 is
declared to be a string, there shouldn''t be any square brackets around
it. Maybe Access is looking for Me.strField1 because of the square
brackets. Anyway, MsgBox("*" & strField1 & "*") to see if it contains
a blank or not. I also don''t see why you need to require a " " in an
''ID'' field. Perhaps use an If..Then..Else on whether or not
InStr(strField1, " ") = 0.
James A. Fortune
这篇关于运行时错误5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!