Recordset字段布尔值读取不正确 [英] Recordset field boolean read incorrectly
问题描述
我有一个表,其中一个布尔字段的值被选中。 但是,每次检查该字段的值是否为"0"。甚至我把"-1"放在在它。
I've a table in which a boolean field whose value is checked. However, every check that field's value is "0" even I put "-1" in it.
布尔字段:F1_4A1;数据类型:是/否
Boolean field : F1_4A1; Data Type: Yes/No
F1_4A1 = -1
F1_4A1 = -1
       对于intCounter = 0到rs.Fields.Count - 1
For intCounter = 0 To rs.Fields.Count - 1
                 如果PSID = rs.Fields(intCounter).Name则为
                      Debug.Print"FPA匹配字段的名称"; rs.Fields(intCounter).Name
                      Debug.Print"匹配字段的类型"; rs.Fields(intCounter).Type
                      Debug.Print"匹配字段的值"; rs.Fields(intCounter).Value
                     如果rs.Fields(intCounter).Value = -1那么
                          vntCrashSessionArray(OLoop,1)=" Y"
                          Debug.Print"FPA Collision match"; vntCrashSessionArray(OLoop,1)
                     否则
                          vntCrashSessionArray(OLoop,1)=" N"
                     结束如果
                 结束如果
             下一个
         结束如果
     下一步
If PSID = rs.Fields(intCounter).Name Then
Debug.Print "FPA matched field's name "; rs.Fields(intCounter).Name
Debug.Print "match field's type "; rs.Fields(intCounter).Type
Debug.Print "match field's value "; rs.Fields(intCounter).Value
If rs.Fields(intCounter).Value = -1 Then
vntCrashSessionArray(OLoop, 1) = "Y"
Debug.Print "FPA Collision match "; vntCrashSessionArray(OLoop, 1)
Else
vntCrashSessionArray(OLoop, 1) = "N"
End If
End If
Next
End If
Next
Debug.print找到以下内容:
Debug.print finds the followings:
Debug.Print" FPA匹配字段的名称" ;; rs.Fields(intCounter).Name
Debug.Print "FPA matched field's name "; rs.Fields(intCounter).Name
      Ans:FPA匹配字段的名称F1_4A1
Ans: FPA matched field's name F1_4A1
Debug.Print" match field's type" ;; rs.Fields(intCounter).Type
Debug.Print "match field's type "; rs.Fields(intCounter).Type
    Ans:匹配字段的类型 11
Ans: match field's type 11
Debug.Print" match field's value" ;; rs.Fields(intCounter).Value
Debug.Print "match field's value "; rs.Fields(intCounter).Value
Ans:匹配字段的值False
Ans: match field's value False
我想知道为什么F1_4A1设置为-1但是如上所示被检查为非-1。 您会建议什么?
I wonder why F1_4A1 is set -1 but is checked as non -1 as shown above. What would you suggest?
提前感谢。
NT100
NT100
推荐答案
你是指你的代码作为输入-1的方法吗? 因为我没有看到发布的代码中发生这种情况。
are you referring to your code as the method to enter -1? because I do not see that happening in the code posted.
这篇关于Recordset字段布尔值读取不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!