Afternoon all,
I am trying to code an unbound form, complete with navigation buttons.
All seems fine, except for the code that checks to see if any of the fields have changed (similar to Dirty I guess).
For some reason it is saying that (depending on what record) the control value is different to that of the field value, when nothing has changed.
I have noticed that it seems to happen on fields where there is no entry, i.e the value is null, but I cannot seem to account for this.
Am I doing something wrong?
Is there some code that would make this task easier?
I seem to be bashing my head against a wall with this one.
The code for the function is as follows:
If the kind ppl of the forum have any ideas/suggestions to help me out that would be most appreciated.
If you need more info then let me know.
Many thanks in advance,
G
Please note:
I cannot use Winzip (or other compression based software) here at work, so am unable to attatch a file for you as the smallest I can get the file is still too large to use as an attachment for the post.
Sorry for the lameness!
I am trying to code an unbound form, complete with navigation buttons.
All seems fine, except for the code that checks to see if any of the fields have changed (similar to Dirty I guess).
For some reason it is saying that (depending on what record) the control value is different to that of the field value, when nothing has changed.
I have noticed that it seems to happen on fields where there is no entry, i.e the value is null, but I cannot seem to account for this.
Am I doing something wrong?
Is there some code that would make this task easier?
I seem to be bashing my head against a wall with this one.
The code for the function is as follows:
Code:
Public Function CheckChange(rstChkChg As DAO.Recordset) As Boolean
'==========
'
' Purpose: Checks to see if the current record has changed,
' usually called when navigating through records.
'
'==========
Dim iChk As Integer
iChk = 0
If iCnt = 0 Then
CheckChange = False
Else
FindRecord rstChkChg
If Me.txtSupplier <> rstChkChg.Fields("Supplier").Value Then
iChk = iChk + 1
Else:
iChk = iChk + 1
End If
If Me.txtAddr1 <> rstChkChg.Fields("Addr1").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.txtAddr2 <> rstChkChg.Fields("Addr2").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.txtAddr3 <> rstChkChg.Fields("Addr3").Value Then
iChk = iChk + 1
Else
iChk = iChk
End If
If Me.txtAddr4 <> rstChkChg.Fields("Addr4").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.cboTown <> rstChkChg.Fields("Town").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.cboCounty <> rstChkChg.Fields("County").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.txtPCode <> rstChkChg.Fields("PCode").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.txtTel <> rstChkChg.Fields("Tel").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.txtFax <> rstChkChg.Fields("Fax").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.txtEmail <> rstChkChg.Fields("Email").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.txtURL <> rstChkChg.Fields("URL").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.chkOld <> rstChkChg.Fields("Old").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
If Me.txtNotes <> rstChkChg.Fields("Notes").Value Then
iChk = iChk + 1
Else:
iChk = iChk
End If
End If
If iChk > 0 Then
CheckChange = True
Else
CheckChange = False
End If
End Function
If the kind ppl of the forum have any ideas/suggestions to help me out that would be most appreciated.
If you need more info then let me know.
Many thanks in advance,
G
Please note:
I cannot use Winzip (or other compression based software) here at work, so am unable to attatch a file for you as the smallest I can get the file is still too large to use as an attachment for the post.
Sorry for the lameness!