iif condition with multiple conditions (1 Viewer)

mba_110

Registered User.
Local time
Today, 11:16
Joined
Jan 20, 2015
Messages
280
I am struct with following iif condition.

Here in i am applying the conditions, first if option7 = True (selected) then it has to check txtEntryNo,txtEntryType,txtEntryDate are not null if its null then it has to give following out put message mentioned in msgbox.

if all goes well then proceed with else part.


Code:
If Me.Option7 = True And (Me.txtEntryDate = Null) And (Me.txtEntryType = Null) And (Me.txtEntryNo = Null) Then
MsgBox "Please Provide all required information !!!"
Else
DoCmd.OpenForm "frmJournalEntry"
DoCmd.Close acForm, Me.Name
End If
End Sub

above code seams to be missing something as its either not performing anything nor giving any error.
 

Ranman256

Well-known member
Local time
Today, 14:16
Joined
Apr 9, 2015
Messages
4,339
NOT: (Me.txtEntryDate = Null)

in code use:
IsNull(Me.txtEntryDate)

and if ALL must be filled in, use OR:
If Me.Option7 = True or Isnull(Me.txtEntryDate) or Isnull(Me.txtEntryType) or Isnull(Me.txtEntryNo) Then
 

June7

AWF VIP
Local time
Today, 10:16
Joined
Mar 9, 2014
Messages
5,423
Cannot test if anything is = Null because Null is nothing, meaning there is nothing there to test, it is unknown. Cannot determine if unknown = unknown. http://allenbrowne.com/casu-12.html
 

Users who are viewing this thread

Top Bottom