Link to home
Start Free TrialLog in
Avatar of qplo
qplo

asked on

Message box show waring if date field is blank

I have data field name date. When I close the database, I like to check this field: if any record have blank then msgbox will showup.
I have small code on close like this

Private Sub Form_Close()
If Me.date = "" Then
MsgBox "Date need update"
End If
End Sub

But not working. Do I miss something here? Please help
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Try this - use the UnLoad event instead

Private Sub Form_UnLoad(Cancel As Integer)
If Nz(Me.date, "") = "" Then
MsgBox "Date need update"
Cancel = True
End If
End Sub

mx
Avatar of qplo
qplo

ASKER

Nope, still not work
Avatar of qplo

ASKER

Anyone can help me, please?
Avatar of qplo

ASKER

I still would like to see any one can help me on this small problem. Thanks
"if any record have blank"

Are you saying in ANY record in the table?  If so, then no, this will not work.

mx
Avatar of qplo

ASKER

I would check for single record if the date field blank , BUT not whole database.
Avatar of qplo

ASKER

MX,
Do you have any other way to make it work? Thanks
Avatar of qplo

ASKER

Hello MX,
Are you still helping me?
Avatar of qplo

ASKER

I just don't know understand why no one can help me to on this small problem here?
Am I in the wrong place?
Avatar of qplo

ASKER

I gave up and would like cancel this question.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of sinjin
sinjin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of qplo

ASKER

I found the code similar like you and work well. However, I really appreciate for your code and I will reward the point for you.
Thank you for your help Sinjin,