syntax question (Not Equal to?)

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
 
K

Karl

-----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 "<>".
 
C

Cheryl Fischer

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 "<>".
 
G

Grace

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 "<>".
.
 
C

Cheryl Fischer

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 "<>".
.
 
G

Grace

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 "<>".
.


.
 
C

Cheryl Fischer

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 "<>".
.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top