syntax question (Not Equal to?)

Discussion in 'Microsoft Access Forms' started by Grace, Feb 4, 2004.

  1. Grace

    Grace Guest

    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
     
    Grace, Feb 4, 2004
    #1
    1. Advertisements

  2. Grace

    Karl Guest


    >-----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 "<>".
     
    Karl, Feb 4, 2004
    #2
    1. Advertisements

  3. Try ...

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


    --

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


    "Karl" <> wrote in message
    news:970301c3eb2c$cf2e9210$...
    >
    > >-----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 "<>".
     
    Cheryl Fischer, Feb 4, 2004
    #3
  4. Grace

    Grace Guest

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

    >.
    >
     
    Grace, Feb 4, 2004
    #4
  5. 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" <> wrote in message
    news:a3be01c3eb3d$4a5e43d0$...
    > 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 "<>".

    > >.
    > >
     
    Cheryl Fischer, Feb 4, 2004
    #5
  6. Grace

    Grace Guest

    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
    >
    >
    >"Grace" <> wrote in

    message
    >news:a3be01c3eb3d$4a5e43d0$...
    >> 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 "<>".
    >> >.
    >> >

    >
    >
    >.
    >
     
    Grace, Feb 4, 2004
    #6
  7. You're welcome.

    --

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


    "Grace" <> wrote in message
    news:9b4401c3eb5c$b3294210$...
    > 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
    > >
    > >
    > >"Grace" <> wrote in

    > message
    > >news:a3be01c3eb3d$4a5e43d0$...
    > >> 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 "<>".
    > >> >.
    > >> >

    > >
    > >
    > >.
    > >
     
    Cheryl Fischer, Feb 4, 2004
    #7
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Dale Lundgren

    Syntax question...

    Dale Lundgren, Sep 24, 2003, in forum: Microsoft Access Forms
    Replies:
    1
    Views:
    215
    Rick Brandt
    Sep 25, 2003
  2. Jithedra Atluri

    Open forms alway in maximise mode _ equal to my desk top screen

    Jithedra Atluri, Jan 9, 2004, in forum: Microsoft Access Forms
    Replies:
    1
    Views:
    266
  3. Guest

    If value entered is not equal to table value

    Guest, May 11, 2005, in forum: Microsoft Access Forms
    Replies:
    6
    Views:
    263
    Van T. Dinh
    May 13, 2005
  4. Parker

    Syntax question

    Parker, Dec 3, 2005, in forum: Microsoft Access Forms
    Replies:
    2
    Views:
    350
    Parker
    Dec 3, 2005
  5. Guest

    Syntax error - question on form?????

    Guest, Jun 1, 2006, in forum: Microsoft Access Forms
    Replies:
    2
    Views:
    243
    Guest
    Jun 5, 2006
  6. Dan

    SQL in vba procedure syntax question.

    Dan, Feb 27, 2007, in forum: Microsoft Access Forms
    Replies:
    2
    Views:
    195
  7. Matt

    DLookup Syntax Question

    Matt, Dec 29, 2008, in forum: Microsoft Access Forms
    Replies:
    3
    Views:
    280
  8. oldblindpew

    Syntax Question

    oldblindpew, Mar 12, 2009, in forum: Microsoft Access Forms
    Replies:
    2
    Views:
    215
    fredg
    Mar 12, 2009
Loading...