-- 作者:33chyh
-- 发布时间:2016/8/3 16:50:00
-- [求助]上一个单元格输入内容总被下一个单元格内容处理时继承
想法说明:我在“卷1答”的表事件datacolchanged中输入以下代码,完成通过比较“卷1答”表中“客观题1”答案和“客观题答案”表中“客观题1”答案对比,找出两者不同的答案,并借助“客观问题描述”表中相关选项值在“学生问题频度”表中记录相关数值。例如“客观题答案”中“客观题1”的答案是“a”,“卷1问”的答案是“b”,需要通过程序借助“客观问题描述”表中找出a、b两个选项的对应描述的值是“知1”和“知2”并给二者分别赋值“1”,再通过两个值在“学生问题频度”表中找到相关列“知1”列和“知2”列,最后将两个值“1”填到“学生问题频度”表的对应单元格中。
疑问:在填写“卷1答”表“客观题2”答案录入后,在“学生问题频度”表中会将“客观题1”录入答案对应值再一次统计。
请专家帮助我看看代码是在哪里出现问题?
Dim kmdr As DataRow = DataTables("客观问题描述").find("试卷号= \'" & DataTables("卷1答").Name.chars(1) & "\'") Dim kfdr As DataRow = DataTables("客观题答案").find("试卷号 = \'" & DataTables("卷1答").Name.chars(1) & "\'" ) Dim kgtfwdr As DataRow = DataTables("学生问题频度").find("学号 = \'" & e.DataRow("学号") & "\'") Dim kegtdr1 As String = e.DataRow("客观题1") Dim kegtdadr1 As String = kfdr("客观题1") If e.DataRow("客观题1") IsNot Nothing Then If kegtdr1.contains("a") = True And kegtdadr1.contains("a") = True Else If kegtdr1.contains("a") = True Or kegtdadr1.contains("a") = True Then Select Case kmdr("第1题A范") Case "知1" kgtfwdr("知1") = 1 Case "知2" kgtfwdr("知2") = 1 Case "知3" kgtfwdr("知3") = 1 Case "知4" kgtfwdr("知4") = 1 End Select End If If kegtdr1.contains("b") = True And kegtdadr1.contains("b") = True Else If kegtdr1.contains("b") = True Or kegtdadr1.contains("b") = True Then Select Case kmdr("第1题B范") Case "知1" kgtfwdr("知1") = kgtfwdr("知1") + 1 Case "知2" kgtfwdr("知2") = kgtfwdr("知2") + 1 Case "知3" kgtfwdr("知3") = kgtfwdr("知3") + 1 Case "知4" kgtfwdr("知4") = kgtfwdr("知4") + 1 End Select End If If kegtdr1.contains("c") = True And kegtdadr1.contains("c") = True Else If kegtdr1.contains("c") = True Or kegtdadr1.contains("c") = True Then Select Case kmdr("第1题C范") Case "知1" kgtfwdr("知1") = kgtfwdr("知1") + 1 Case "知2" kgtfwdr("知2") = kgtfwdr("知2") + 1 Case "知3" kgtfwdr("知3") = kgtfwdr("知3") + 1 Case "知4" kgtfwdr("知4") = kgtfwdr("知4") + 1 End Select End If If kegtdr1.contains("d") = True And kegtdadr1.contains("d") = True Else If kegtdr1.contains("d") = True Or kegtdadr1.contains("d") = True Then Select Case kmdr("第1题D范") Case "知1" kgtfwdr("知1") = kgtfwdr("知1") + 1 Case "知2" kgtfwdr("知2") = kgtfwdr("知2") + 1 Case "知3" kgtfwdr("知3") = kgtfwdr("知3") + 1 Case "知4" kgtfwdr("知4") = kgtfwdr("知4") + 1 End Select End If End If Dim kegtdr2 As String = e.DataRow("客观题2") Dim kegtdadr2 As String = kfdr("客观题2") If e.DataRow.Isnull("客观题2") Then Else If kfdr("客观题2") IsNot Nothing Then If kegtdr2.contains("a") = True And kegtdadr2.contains("a") = True Else If kegtdr2.contains("a") = True OrElse kegtdadr2.contains("a") = True Then Select Case kmdr("第2题A范") Case "知1" kgtfwdr("知1") = kgtfwdr("知1") + 1 Case "知2" kgtfwdr("知2") = kgtfwdr("知2") + 1 Case "知3" kgtfwdr("知3") = kgtfwdr("知3") + 1 Case "知4" kgtfwdr("知4") = kgtfwdr("知4") + 1 End Select End If If kegtdr2.contains("b") = True And kegtdadr2.contains("b") = True Else If kegtdr2.contains("b") = True OrElse kegtdadr2.contains("b") = True Then Select Case kmdr("第2题B范") Case "知1" kgtfwdr("知1") = kgtfwdr("知1") + 1 Case "知2" kgtfwdr("知2") = kgtfwdr("知2") + 1 Case "知3" kgtfwdr("知3") = kgtfwdr("知3") + 1 Case "知4" kgtfwdr("知4") = kgtfwdr("知4") + 1 End Select End If If kegtdr2.contains("c") = True And kegtdadr2.contains("c") = True Else If kegtdr2.contains("c") = True OrElse kegtdadr2.contains("c") = True Then Select Case kmdr("第2题C范") Case "知1" kgtfwdr("知1") = kgtfwdr("知1") + 1 Case "知2" kgtfwdr("知2") = kgtfwdr("知2") + 1 Case "知3" kgtfwdr("知3") = kgtfwdr("知3") + 1 Case "知4" kgtfwdr("知4") = kgtfwdr("知4") + 1 End Select End If If kegtdr2.contains("d") = True And kegtdadr2.contains("d") = True Else If kegtdr2.contains("d") = True OrElse kegtdadr2.contains("d") = True Then Select Case kmdr("第2题D范") Case "知1" kgtfwdr("知1") = kgtfwdr("知1") + 1 Case "知2" kgtfwdr("知2") = kgtfwdr("知2") + 1 Case "知3" kgtfwdr("知3") = kgtfwdr("知3") + 1 Case "知4" kgtfwdr("知4") = kgtfwdr("知4") + 1 End Select End If End If If e.DataRow.IsNull("客观题1") And e.DataRow.IsNull("客观题2") Then kgtfwdr("知1") = Nothing kgtfwdr("知2") = Nothing kgtfwdr("知3") = Nothing kgtfwdr("知4") = Nothing End If
|