B
Billp
Hi,
Some will have objections to what I am doing and call it messy - but anyway.
If a field has had its value changed I want to be able to continue with the
audit if it has not then - allow the form to close without saving.
So I have added the following to the forms beforeUpdate.
The two fields that I want to check are numeric
Me!Eng_Cost and Me!Ext_Cost
I have tried the .Dirty and it is not intended to work here.
So
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Confirm with user that this record is to be modified
Dim updRecord As Byte
updRecord = MsgBox("Confirm - That you are making a record change",
vbOKCancel, "Record Modification")
If updRecord = vbCancel Then
'Cancel = True
Me.Undo
DoCmd.Close acForm, "forms.frmWCard_Edit"
Else 'yes
' first check if Eng_Cost and or Ext_Cost have changed and if so allow
audit
'Purpose: Write a copy of the old values to temp table.
' It is then copied to the true audit table in AuditEditEnd.
'Arugments: sTable = name of table being audited.
' sAudTmpTable = name of the temp audit table.
' sKeyField = name of the AutoNumber field.
' lngKeyValue = Value of the AutoNumber field.
' bWasNewRecord = True if this was a new insert.
bwasNewRecord = Me.NewRecord
Call AuditEditBegin("tblWorksCard", "audTmpWorksCard", "WCard_ID",
Nz(Me!WCard_ID, 0), bwasNewRecord)
End If
End Sub
Thanks for ideas and comments.
Regards
Bill
Some will have objections to what I am doing and call it messy - but anyway.
If a field has had its value changed I want to be able to continue with the
audit if it has not then - allow the form to close without saving.
So I have added the following to the forms beforeUpdate.
The two fields that I want to check are numeric
Me!Eng_Cost and Me!Ext_Cost
I have tried the .Dirty and it is not intended to work here.
So
Private Sub Form_BeforeUpdate(Cancel As Integer)
' Confirm with user that this record is to be modified
Dim updRecord As Byte
updRecord = MsgBox("Confirm - That you are making a record change",
vbOKCancel, "Record Modification")
If updRecord = vbCancel Then
'Cancel = True
Me.Undo
DoCmd.Close acForm, "forms.frmWCard_Edit"
Else 'yes
' first check if Eng_Cost and or Ext_Cost have changed and if so allow
audit
'Purpose: Write a copy of the old values to temp table.
' It is then copied to the true audit table in AuditEditEnd.
'Arugments: sTable = name of table being audited.
' sAudTmpTable = name of the temp audit table.
' sKeyField = name of the AutoNumber field.
' lngKeyValue = Value of the AutoNumber field.
' bWasNewRecord = True if this was a new insert.
bwasNewRecord = Me.NewRecord
Call AuditEditBegin("tblWorksCard", "audTmpWorksCard", "WCard_ID",
Nz(Me!WCard_ID, 0), bwasNewRecord)
End If
End Sub
Thanks for ideas and comments.
Regards
Bill