If you forget any field is empty , MsgBox alerts the forgotten field

Falcon88

Registered User.
Local time
Tomorrow, 01:42
Joined
Nov 4, 2014
Messages
309
i have a continous form that is belong to values of three unbound fields.
[TestName]
[FromDate]
[ToDate]
and a commandbutton that makes requery for this continous form.

when i click on this command button , if any field is empty ; what's the appropriate code that i can use to alerts me the name of the forgotten field ?
 
Hello,
Like this :
Code:
 If IsNull(Me.[TestName]) or Me.TestName = "" then
     MsgBox ("There is no data in TexteName")
     Me.TestName.SetFocus
     Exit Sub
If IsNull(Me.[FromDate]) or Me.FromDate= ""  or Not IsDate(Me.FromDate) then
     MsgBox ("There is no data in FromDate or a value is not a date !")
     Me.TestName.SetFocus
     Exit Sub
End If
If IsNull(Me.[ToDate]) or Me.ToDate= ""  or Not IsDate(Me.ToDate) then
     MsgBox ("There is no data in ToDate")
     Me.TestName.SetFocus
End If
Have a good continuation
 
But i have [FromDate] and [ToDate] date type data. How to remove an access Msg.? which tell me that there is an error in this field's data type
 
use Date Format on Property sheet
 

Users who are viewing this thread

Back
Top Bottom