Private
Sub
Form_Close()
Dim
db
As
DAO.Database
Dim
rstUpro
As
DAO.Recordset2
Dim
rst
As
DAO.Recordset2
Dim
rst2
As
DAO.Recordset2
Dim
strSQL
As
String
Dim
var
Dim
Datum2
As
Date
Dim
arrWords()
As
String
Dim
iCount_old
As
Integer
Dim
arrWords2()
As
String
Dim
iCount_New
As
Integer
Dim
Uproposition
As
String
Set
db = CurrentDb
Set
rstUpro = db.OpenRecordset(
"Upro"
, dbOpenDynaset)
rstUpro.MoveFirst
Do
While
Not
rstUpro.EOF
Uproposition = rstUpro!position
If
IsNull(DMax(
"Datum"
,
"Upro_Spaltenverlauf_von_Beschreibung"
,
"[Position] = '"
& Nz(Uproposition,
""
) &
"'"
))
Then
GoTo
Sprung1
Else
Datum2 = DMax(
"Datum"
,
"Upro_Spaltenverlauf_von_Beschreibung"
,
"[Position] = '"
& Nz(Uproposition,
""
) &
"'"
)
strSQL =
"Select * from Upro_Spaltenverlauf_von_Beschreibung where Position = '"
& Nz(Uproposition,
""
) &
"'"
Set
rst2 = db.OpenRecordset(strSQL)
If
Not
rst2.EOF
Then
rst2.MoveFirst
Do
Until
rst2!Datum = Datum2
rst2.MoveNext
If
rst2.EOF =
True
Then
Exit
Do
Loop
var = rst2!Beschreibung
arrWords = Split(rst2!Beschreibung,
" "
)
iCount_old = UBound(arrWords) + 1
MsgBox
"Dein Text enthält "
& iCount_old &
" Wörter."
arrWords2 = Split(
Me
!Beschreibung,
" "
)
iCount_New = UBound(arrWords2) + 1
MsgBox
"Dein Text enthält "
& iCount_New &
" Wörter."
rst2.Close
Set
rst2 =
Nothing
Set
db =
Nothing
If
iCount_New >= (iCount_old + 2)
Or
iCount_New <= (iCount_old - 2)
Then
Sprung1:
Set
rst = db.OpenRecordset(
"Allg_Umbau_Daten"
)
With
CurrentDb().OpenRecordset(
"Upro_Spaltenverlauf_von_Beschreibung"
, dbOpenDynaset, dbAppendOnly)
.AddNew
!position =
Me
!position
!Beschreibung =
Me
!Beschreibung
!Produkt = rst!Produkt
.Update
End
With
Else
rstUpro.MoveNext
If
rstUpro.EOF =
True
Then
Exit
Do
Loop
End
If
End
If
exit_1:
End
Sub