Adam McReynolds
Registered User.
- Local time
- Today, 08:34
- Joined
- Aug 6, 2012
- Messages
- 129
This is for a repair database. I currently have a DCount to determine if a unit was previously in for repair and a msgbox that gives a warning to check for a warranty sticker. I want to have a field(incoming_disposition) changed to 'Warranty' if the last occurrence(DMax?) of the field(complete_date) is within 6 months and 1 week(grace period) from the current date. This would take place in AfterUpdate on the fields(bar_code & Incoming_Module_Sn).
I was wondering if the msgbox warning could execute as in my current code(below) and a option to execute the code I am speaking about to change the field to 'Warranty' could be given in a yes/no in the msgbox. Like: "This unit was last completed on [insert last occurrence(complete_date)]. Would you like to mark this as a warranty?"
Any help would be much appreciated.
Current code:
I was wondering if the msgbox warning could execute as in my current code(below) and a option to execute the code I am speaking about to change the field to 'Warranty' could be given in a yes/no in the msgbox. Like: "This unit was last completed on [insert last occurrence(complete_date)]. Would you like to mark this as a warranty?"
Any help would be much appreciated.
Current code:
Code:
Private Sub Bar_Code_AfterUpdate()
If Nz(DCount("bar_code", "tbl_Module_Repairs", "bar_code = '" & Me.Bar_Code.Text & "'"), 0) > 0 Then
If MsgBox("The Barcode already exists. Check Warranty! Do you wish to continue?", vbOKCancel, "Duplicate Warning") = vbCancel Then
Cancel = True
Me.Undo
Exit Sub
End If
End If
End Sub