为什么把这段代码写在PrepareEdit事件,第一次点击财务数据源表单元格时出现焦点不在点击单元格上?注识掉这段代码就没出现这种现象?
If e.IsFocusCell Then
If e.Col.Name = "金额" Then
If (e.Row("字号") = "现收" OrElse e.Row("字号") = "银收" OrElse e.Row("字号") = "现付" OrElse e.Row("字号") = "银付") AndAlso (e.Row("会计科目") = "1001 库存现金" OrElse e.Row("会计科目") = "1002 银行存款") Then
e.Col.DropForm = "会计选出纳账数据"
Tables("财务数据源").Cols("借方金额").DropForm = Nothing
Tables("财务数据源").Cols("贷方金额").DropForm = Nothing
e.Col.DropForm = "会计选出纳账数据"
ElseIf (e.Row("字号") = "现收" OrElse e.Row("字号") = "银收" OrElse e.Row("字号") = "现付" OrElse e.Row("字号") = "银付") AndAlso (e.Row("会计科目") <> "1001 库存现金" OrElse e.Row("会计科目") <> "1002 银行存款") Then
e.Col.DropForm = Nothing
Tables("财务数据源").Cols("借方金额").DropForm = Nothing
Tables("财务数据源").Cols("贷方金额").DropForm = Nothing
End If
End If
ElseIf e.Col.Name = "借方金额" Then
If e.Row("字号") = "转字" AndAlso e.Row("会计科目") = "1015 其他货币资金" Then
e.Col.DropForm = "会计选出纳账数据"
Tables("财务数据源").Cols("金额").DropForm = Nothing
ElseIf e.Row("字号") = "转字" AndAlso e.Row("会计科目") <> "1015 其他货币资金" Then
e.Col.DropForm = Nothing
Tables("财务数据源").Cols("金额").DropForm = Nothing
End If
ElseIf e.Col.Name = "贷方金额" Then
If e.Row("字号") = "转字" AndAlso e.Row("会计科目") = "1015 其他货币资金" Then
e.Col.DropForm = "会计选出纳账数据"
Tables("财务数据源").Cols("金额").DropForm = Nothing
ElseIf e.Row("字号") = "转字" AndAlso e.Row("会计科目") <> "1015 其他货币资金" Then
e.Col.DropForm = Nothing
Tables("财务数据源").Cols("金额").DropForm = Nothing
End If
End If