Hallo Dieter,
Hallo Community
Ich hab eine kleine Herausfoderung mir dem SevGrid2.
Das BeforeUpdate-Ereignis wird immer zwei mal ausgeführt. Dies passiert nur nicht, wenn das Prüffeld eine Combobox ist. Unten einmal der Code.
Jemand eine Idee?
Besten Dank im Voraus.
Dim bRequierd As Boolean
Dim bDependOnRS As Boolean
Dim sColCBSourceField As String
Dim sDBSource As String
Dim sDBSourceField As String
Dim lCount As Long
On Error GoTo function_error
If nCol <> 0 Then
bRequierd = gvGridColsProperty(True, "bColFillBequired", gsCStr( _
sFormName), gsCStr(sGridName), oGrid.Columns(nCol).Key)
bDependOnRS = gvGridColsProperty(True, "bColDataDependOnRS", gsCStr( _
sFormName), gsCStr(sGridName), oGrid.Columns(nCol).Key)
If bDependOnRS = True Then
sColCBSourceField = gvGridColsProperty(True, "sColCBSourceField", _
gsCStr(sFormName), gsCStr(sGridName), oGrid.Columns(nCol).Key)
sDBSource = gvGridColsProperty(True, "sColDBSource", gsCStr( _
sFormName), gsCStr(sGridName), oGrid.Columns(nCol).Key)
sDBSourceField = gvGridColsProperty(True, "sColDBSourceField", _
gsCStr(sFormName), gsCStr(sGridName), oGrid.Columns(nCol).Key)
End If
With oGrid
'If .IsEditMode = MODE_ADDNEW Then
If (Len(sText) = 0 Or sText = "0,00") And bRequierd = True Then
nil = gnMessage(100007, gsCStr(oGrid.Columns(nCol).Caption))
Cancel = 2
GoTo function_exit
End If
If Len(sText) <> 0 And bDependOnRS = True And bRequierd = _
True Then
lCount = 0
lCount = goMandant.oData.lCount(sDBSource, "Mandant = " & _
goMandant.nID & " AND " & _
sDBSourceField _
& "=" & _
gsStr2Sql( _
.EditSubItem( _
sColCBSourceFie_
ld)))
If lCount = 0 Then
nil = gnMessage(100008, gsCStr(oGrid.Columns( _
nCol).Caption))
Cancel = 2
GoTo function_exit
End If
End If
If (.Columns(nCol).InputType = INPUT_DATE Or _
.Columns(nCol).InputType = INPUT_DATETIME) And _
(bRequierd = True Or Len(sText) <> 0) Then
If IsDate(sText) = False Then
nil = gnMessage(100009, gsCStr(oGrid.Columns( _
nCol).Caption))
Cancel = 2
GoTo function_exit
End If
End If
'ElseIf .IsEditMode = MODE_EDIT Then
'End If
End With
End If
Cancel = 0
GoTo function_exit
function_error:
Cancel = 1
nil = MsgBox(Err.Description, vbCritical + vbOKOnly, Err.Source)
function_exit:
'Clean Up |