Can someone help me I'm having some problem with this. I am supposed to make a sytem that will alert if the medicine was expired.
here is my code.
Private Sub DataGrid1_Click()
On Error Resume Next
Command2.Enabled = True
With frmmed1
.Combo1 = Adodc1.Recordset.Fields("MedicineName")
.Text3.Text = Adodc1.Recordset.Fields("StockQuantity")
.Combo2 = Adodc1.Recordset.Fields("Expmonth")
.Combo3 = Adodc1.Recordset.Fields("Expday")
.Combo4 = Adodc1.Recordset.Fields("Expyear")
End With
Dim currentdate As Date
Dim expirationdate
currentdate = DateValue(Now)
expirationdate = Combo2 & Combo3 & Combo4
datepicker.value = Format(Now, "MMM-DD-yyyy")
If datepicker < expirationdate Then (-----I'm having trouble in this line---)
MsgBox "OK! =)", , "Working"
Text2.Enabled = True
Else
MsgBox "Medicine Expired! Click OK to delete.", vbExclamation, " Warning!!!"
Text2.Enabled = False
If MsgBox("Are you want to delete " & Combo1 & "?", vbQuestion + vbYesNo, "Message") = vbYes Then
Adodc1.Recordset.Delete
ElseIf vbNo Then Exit Sub
End If
End If
End Sub