syntax question (Not Equal to?)

  • Thread starter Thread starter Grace
  • Start date Start date
G

Grace

In the code below, I would like the msg box to appear if
the [CallStatus] field is not equal to "Closed". I just
don't know the syntax for "not equal to"!

If [CallStatus] not equal to "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to Closed.",
vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

Thanks for your help
 
-----Original Message-----
In the code below, I would like the msg box to appear if
the [CallStatus] field is not equal to "Closed". I just
don't know the syntax for "not equal to"!

If [CallStatus] not equal to "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to Closed.",
vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

Thanks for your help
.
I would use "<>".
 
Try ...

If [CallStatus] <> "Closed" And Not IsNull ([Closedby]) Then
...<rest of code>


--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Karl said:
-----Original Message-----
In the code below, I would like the msg box to appear if
the [CallStatus] field is not equal to "Closed". I just
don't know the syntax for "not equal to"!

If [CallStatus] not equal to "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to Closed.",
vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

Thanks for your help
.
I would use "<>".
 
Ok, thanks for the syntax information. Now I am having
another problem, I would like the code to check 2 things.
The first part of the code (where [CallStatus]="closed")
works great, but I would also like it to check if the
Closedby field is NOT null and the [CallStatus] field is
not equal to "Closed" then bring up an error message. I
am getting a compile error on the ElseIf. I assume I am
not writing this correctly. (Can you tell my VBA
knowledge is lacking??!!)

If [CallStatus] = "Closed" And IsNull([Closedby]) Then
MsgBox "You must enter the Closed By information.",
vbOKOnly
[Closedby].SetFocus
Cancel = True

ElseIf [CallStatus] <> "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to
Closed.", vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

End If


Thank you,
Grace
-----Original Message-----
-----Original Message-----
In the code below, I would like the msg box to appear if
the [CallStatus] field is not equal to "Closed". I just
don't know the syntax for "not equal to"!

If [CallStatus] not equal to "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to Closed.",
vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

Thanks for your help
.
I would use "<>".
.
 
Hello Grace,

I believe the problem in the following line:

ElseIf [CallStatus] <> "Closed" And IsNotNull ([Closedby]) Then

is that there is not a function named IsNotNull().

How about trying the following:

ElseIf [CallStatus] <> "Closed" and Not IsNull([Closedby]) then


hth and let us know...
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Grace said:
Ok, thanks for the syntax information. Now I am having
another problem, I would like the code to check 2 things.
The first part of the code (where [CallStatus]="closed")
works great, but I would also like it to check if the
Closedby field is NOT null and the [CallStatus] field is
not equal to "Closed" then bring up an error message. I
am getting a compile error on the ElseIf. I assume I am
not writing this correctly. (Can you tell my VBA
knowledge is lacking??!!)

If [CallStatus] = "Closed" And IsNull([Closedby]) Then
MsgBox "You must enter the Closed By information.",
vbOKOnly
[Closedby].SetFocus
Cancel = True

ElseIf [CallStatus] <> "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to
Closed.", vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

End If


Thank you,
Grace
-----Original Message-----
-----Original Message-----
In the code below, I would like the msg box to appear if
the [CallStatus] field is not equal to "Closed". I just
don't know the syntax for "not equal to"!

If [CallStatus] not equal to "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to Closed.",
vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

Thanks for your help
.
I would use "<>".
.
 
That worked GREAT!! Thanks so much.

Grace
-----Original Message-----
Hello Grace,

I believe the problem in the following line:

ElseIf [CallStatus] <> "Closed" And IsNotNull ([Closedby]) Then

is that there is not a function named IsNotNull().

How about trying the following:

ElseIf [CallStatus] <> "Closed" and Not IsNull ([Closedby]) then


hth and let us know...
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Ok, thanks for the syntax information. Now I am having
another problem, I would like the code to check 2 things.
The first part of the code (where [CallStatus]="closed")
works great, but I would also like it to check if the
Closedby field is NOT null and the [CallStatus] field is
not equal to "Closed" then bring up an error message. I
am getting a compile error on the ElseIf. I assume I am
not writing this correctly. (Can you tell my VBA
knowledge is lacking??!!)

If [CallStatus] = "Closed" And IsNull([Closedby]) Then
MsgBox "You must enter the Closed By information.",
vbOKOnly
[Closedby].SetFocus
Cancel = True

ElseIf [CallStatus] <> "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to
Closed.", vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

End If


Thank you,
Grace
-----Original Message-----

-----Original Message-----
In the code below, I would like the msg box to appear if
the [CallStatus] field is not equal to "Closed". I just
don't know the syntax for "not equal to"!

If [CallStatus] not equal to "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to Closed.",
vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

Thanks for your help
.
I would use "<>".
.


.
 
You're welcome.

--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Grace said:
That worked GREAT!! Thanks so much.

Grace
-----Original Message-----
Hello Grace,

I believe the problem in the following line:

ElseIf [CallStatus] <> "Closed" And IsNotNull ([Closedby]) Then

is that there is not a function named IsNotNull().

How about trying the following:

ElseIf [CallStatus] <> "Closed" and Not IsNull ([Closedby]) then


hth and let us know...
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


Ok, thanks for the syntax information. Now I am having
another problem, I would like the code to check 2 things.
The first part of the code (where [CallStatus]="closed")
works great, but I would also like it to check if the
Closedby field is NOT null and the [CallStatus] field is
not equal to "Closed" then bring up an error message. I
am getting a compile error on the ElseIf. I assume I am
not writing this correctly. (Can you tell my VBA
knowledge is lacking??!!)

If [CallStatus] = "Closed" And IsNull([Closedby]) Then
MsgBox "You must enter the Closed By information.",
vbOKOnly
[Closedby].SetFocus
Cancel = True

ElseIf [CallStatus] <> "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to
Closed.", vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

End If


Thank you,
Grace
-----Original Message-----

-----Original Message-----
In the code below, I would like the msg box to appear if
the [CallStatus] field is not equal to "Closed". I just
don't know the syntax for "not equal to"!

If [CallStatus] not equal to "Closed" And IsNotNull
([Closedby]) Then
MsgBox "You must change the Call Status to Closed.",
vbOKOnly
[CallStatus].SetFocus
Cancel = True
End If

Thanks for your help
.
I would use "<>".
.


.
 
Back
Top