DataChanged




Public Function DataChanged(MainRS As Recordset, _
ByVal strForm As Form) As Boolean
Dim i As Long
On Error Goto ErrHand
frmProgress.Show
frmProgress.Visible = True
frmProgress.Caption = "Checking For Changes..."
frmProgress.ProgressBar1.Max = strForm.Controls.count - 1
frmProgress.ProgressBar1.Min = 1
DataChanged = False

For i = 0 To strForm.Controls.count - 1
If i > 0 Then
frmProgress.ProgressBar1.Value = i
End If

If i = strForm.Controls.count Then
Exit For
End If

If TypeOf strForm.Controls(i) Is TextBox Then
If Len(Trim(strForm.Controls(i).Tag)) <> 0 Then
If Len(strForm.Controls(i).Text) <> 0 Then
If MainRS.Fields(strForm.Controls(i).Tag).Type = 8 Then
If MainRS(strForm.Controls(i).Tag) <> _
CDate(strForm.Controls(i).Text) Then
DataChanged = True
End If
Else
If MainRS(strForm.Controls(i).Tag) <> _
strForm.Controls(i).Text Then
DataChanged = True
End If
End If
End If
End If
ElseIf TypeOf strForm.Controls(i) Is MaskEdBox Then
If Len(Trim(strForm.Controls(i).Text)) <> 0 Then
If MainRS.Fields(strForm.Controls(i).Tag).Type = 8 Then
If MainRS(strForm.Controls(i).Tag) <> _
CDate(strForm.Controls(i).Text) Then
DataChanged = True
End If
Else
If MainRS(strForm.Controls(i).Tag) <> _
strForm.Controls(i).Text Then
DataChanged = True
End If
End If
End If
ElseIf TypeOf strForm.Controls(i) Is ComboBox Then
If Trim(strForm.Controls(i).Tag) <> "" Then
If Len(Trim(strForm.Controls(i).Text)) <> 0 Then
If Trim(MainRS(strForm.Controls(i).Tag)) <> _
Trim(strForm.Controls(i).Text) Then
DataChanged = True
End If
End If
End If
ElseIf TypeOf strForm.Controls(i) Is CheckBox Then
If Len(Trim(strForm.Controls(i).Value)) <> 0 Then
If Len(Trim(strForm.Controls(i).Tag)) <> 0 Then
If strForm.Controls(i).Value = 1 Then
If MainRS(strForm.Controls(i).Tag) <> True Then
'DataChanged = True

End If
Else
If MainRS(strForm.Controls(i).Tag) <> False Then
'DataChanged = true

End If
End If
End If
End If
End If
Next i
Unload frmProgress
Exit Function

ErrHand:

MsgBox "Errore sul salvataggio dei Dati. Error: " _
& Err.Description
Call StoreErrors(Err.Number, Err.Description, Err.source)
Resume Next

End Function Restituisce un valore Boolean:
True =dati modificati
False = Dati non modificati

Questo programma non utilizza datacontrols ma il metodo
di accesso ai dati via DAO.
I controlli sono DataBound e vengono verificati mediante
la proprieta TAG










( datachanged.html )- by Paolo Puglisi - Modifica del 17/12/2023