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?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dennis Schmidt

    RE: Set field equal to multiple textboxes

    Dennis Schmidt, Aug 5, 2003, in forum: Microsoft Access Forms
    Replies:
    0
    Views:
    211
    Dennis Schmidt
    Aug 5, 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:
    180
  3. Dave

    Value Equal Zero if Empty

    Dave, Aug 3, 2004, in forum: Microsoft Access Forms
    Replies:
    1
    Views:
    137
  4. Dan

    date field being equal to the lastPaymentDate

    Dan, Sep 2, 2004, in forum: Microsoft Access Forms
    Replies:
    2
    Views:
    143
  5. Guest

    If value entered is not equal to table value

    Guest, May 11, 2005, in forum: Microsoft Access Forms
    Replies:
    6
    Views:
    153
    Van T. Dinh
    May 13, 2005
Loading...

Share This Page