If Statement

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • N J

    #1

    If Statement

    Hi,

    I am using the following code...

    I want access to check to see if field 'despatched' is already TRUE, if it
    is true then I would like a msgbox to popup saying 'already despatched' then
    2 command buttons, one to cancel and not overwrite the details, the other to
    continue and overwrite old details with new ones.

    Thanks you....

    Dim strsql As String

    CurrentDb.Execu te "Update tblDownload Set DESPATCHED = True, TRACKING = """
    & Me.txtTracking & """, DESPDATE = """ & Me.txtDate & """, TODAYDATE = """ &
    Me.txtTodayDate & """, Courier = """ & Me.cmbDeliveryM ethod & """ Where ID =
    " & Me.txtOrderNumb er & ";", dbfailonerror
    Me.StatusListBo x.AddItem "ORDER # " & Me.txtOrderNumb er & " DESPATCHED AND
    ALLOCATED TRACKING #" & Me.txtTracking & "", 0
    txtOrderNumber. SetFocus

    --

    Kind Regards,
    Customer Services
    P.S. For us to answer your emails efficiently, please always include the
    original message. Thank you.


  • Keith

    #2
    Re: If Statement

    "N J" <bluebelltradin g@blueyonder.co .uk> wrote in message
    news:8VnIe.623$ ia4.489@fe1.new s.blueyonder.co .uk...[color=blue]
    > Hi,
    >
    > I am using the following code...
    >
    > I want access to check to see if field 'despatched' is already TRUE, if it
    > is true then I would like a msgbox to popup saying 'already despatched'
    > then 2 command buttons, one to cancel and not overwrite the details, the
    > other to continue and overwrite old details with new ones.
    >[/color]
    Where are you testing the field contents, on a form? Is the field boolean?
    If so, something like this attached to the form's Before Update event will
    do:

    If Me.chkMyCheckBo x Then
    If(MsgBox "This will overwrite existing data - continue?", vbYesNo,
    "Confirm change") = vbNo Then
    Cancel = True
    Exit Sub
    End If

    HTH - Keith.



    Comment

    • Keith

      #3
      Re: If Statement

      "N J" <bluebelltradin g@blueyonder.co .uk> wrote in message
      news:8VnIe.623$ ia4.489@fe1.new s.blueyonder.co .uk...[color=blue]
      > Hi,
      >
      > I am using the following code...
      >
      > I want access to check to see if field 'despatched' is already TRUE, if it
      > is true then I would like a msgbox to popup saying 'already despatched'
      > then 2 command buttons, one to cancel and not overwrite the details, the
      > other to continue and overwrite old details with new ones.
      >[/color]
      Where are you testing the field contents, on a form? Is the field boolean?
      If so, something like this attached to the form's Before Update event will
      do:

      If Me.chkMyCheckBo x Then
      If(MsgBox "This will overwrite existing data - continue?", vbYesNo,
      "Confirm change") = vbNo Then
      Cancel = True
      Exit Sub
      End If

      HTH - Keith.



      Comment

      • N J

        #4
        Re: If Statement

        Hi Keith,

        Thanks, The field contents are actually in a table, so chkMyCheckBox does
        not exist. The field is Boolean.

        Thanx.

        --

        Kind Regards,
        Customer Services
        P.S. For us to answer your emails efficiently, please always include the
        original message. Thank you.
        "Keith" <keith.wilby@ba eAWAYWITHITsyst ems.com> wrote in message
        news:42f21ce9$1 _1@glkas0286.gr eenlnk.net...[color=blue]
        > "N J" <bluebelltradin g@blueyonder.co .uk> wrote in message
        > news:8VnIe.623$ ia4.489@fe1.new s.blueyonder.co .uk...[color=green]
        >> Hi,
        >>
        >> I am using the following code...
        >>
        >> I want access to check to see if field 'despatched' is already TRUE, if
        >> it is true then I would like a msgbox to popup saying 'already
        >> despatched' then 2 command buttons, one to cancel and not overwrite the
        >> details, the other to continue and overwrite old details with new ones.
        >>[/color]
        > Where are you testing the field contents, on a form? Is the field
        > boolean? If so, something like this attached to the form's Before Update
        > event will do:
        >
        > If Me.chkMyCheckBo x Then
        > If(MsgBox "This will overwrite existing data - continue?", vbYesNo,
        > "Confirm change") = vbNo Then
        > Cancel = True
        > Exit Sub
        > End If
        >
        > HTH - Keith.
        > www.keithwilby.com
        >[/color]


        Comment

        • N J

          #5
          Re: If Statement

          Hi Keith,

          Thanks, The field contents are actually in a table, so chkMyCheckBox does
          not exist. The field is Boolean.

          Thanx.

          --

          Kind Regards,
          Customer Services
          P.S. For us to answer your emails efficiently, please always include the
          original message. Thank you.
          "Keith" <keith.wilby@ba eAWAYWITHITsyst ems.com> wrote in message
          news:42f21ce9$1 _1@glkas0286.gr eenlnk.net...[color=blue]
          > "N J" <bluebelltradin g@blueyonder.co .uk> wrote in message
          > news:8VnIe.623$ ia4.489@fe1.new s.blueyonder.co .uk...[color=green]
          >> Hi,
          >>
          >> I am using the following code...
          >>
          >> I want access to check to see if field 'despatched' is already TRUE, if
          >> it is true then I would like a msgbox to popup saying 'already
          >> despatched' then 2 command buttons, one to cancel and not overwrite the
          >> details, the other to continue and overwrite old details with new ones.
          >>[/color]
          > Where are you testing the field contents, on a form? Is the field
          > boolean? If so, something like this attached to the form's Before Update
          > event will do:
          >
          > If Me.chkMyCheckBo x Then
          > If(MsgBox "This will overwrite existing data - continue?", vbYesNo,
          > "Confirm change") = vbNo Then
          > Cancel = True
          > Exit Sub
          > End If
          >
          > HTH - Keith.
          > www.keithwilby.com
          >[/color]


          Comment

          • Keith

            #6
            Re: If Statement

            "N J" <bluebelltradin g@blueyonder.co .uk> wrote in message
            news:ngqIe.755$ ia4.696@fe1.new s.blueyonder.co .uk...[color=blue]
            > Hi Keith,
            >
            > Thanks, The field contents are actually in a table, so chkMyCheckBox does
            > not exist. The field is Boolean.
            >[/color]
            I would think that the easiest way would be to include a (hidden) check box
            bound to the boolean field on your form and use my code example as a starter
            for 10.


            Comment

            • Keith

              #7
              Re: If Statement

              "N J" <bluebelltradin g@blueyonder.co .uk> wrote in message
              news:ngqIe.755$ ia4.696@fe1.new s.blueyonder.co .uk...[color=blue]
              > Hi Keith,
              >
              > Thanks, The field contents are actually in a table, so chkMyCheckBox does
              > not exist. The field is Boolean.
              >[/color]
              I would think that the easiest way would be to include a (hidden) check box
              bound to the boolean field on your form and use my code example as a starter
              for 10.


              Comment

              Working...