clear/reset the bounded fields in a form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • karsagarwal@gmail.com

    clear/reset the bounded fields in a form

    I have a bounded form and after I click the button to update/save. THe
    fields are still there. Is there a way to clear off the fields in the
    bounded form.

    Thanks,
    SA

    Here's the code that I have:

    Private Sub cmdSave_Click()
    On Error GoTo Err_cmdSave_Cli ck

    Dim Response
    DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
    acMenuVer70
    Response = MsgBox("The component has been successfully
    updated !!", vbOKOnly, "Component Updated")

    Exit_cmdSave_Cl ick:
    Exit Sub

    Err_cmdSave_Cli ck:
    MsgBox Err.Description
    Resume Exit_cmdSave_Cl ick

    End Sub
  • Salad

    #2
    Re: clear/reset the bounded fields in a form

    karsagarwal@gma il.com wrote:
    I have a bounded form and after I click the button to update/save. THe
    fields are still there. Is there a way to clear off the fields in the
    bounded form.
    >
    Thanks,
    SA
    >
    Here's the code that I have:
    >
    Private Sub cmdSave_Click()
    On Error GoTo Err_cmdSave_Cli ck
    >
    Dim Response
    DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
    acMenuVer70
    Response = MsgBox("The component has been successfully
    updated !!", vbOKOnly, "Component Updated")
    >
    Exit_cmdSave_Cl ick:
    Exit Sub
    >
    Err_cmdSave_Cli ck:
    MsgBox Err.Description
    Resume Exit_cmdSave_Cl ick
    >
    End Sub
    I don't get it. When you save a record, do you want it to clear the
    values of that record? Then you save it and overwrite it?

    Bound means associated to a table's records via the control's data source.

    You could move to another new record. Maybe want you want to do is open
    the form in DataEntry mode (under DataTab in Form's property sheet)

    Also see the GoToRecord method/action in help.

    Shoulder Holster



    Comment

    • karsagarwal@gmail.com

      #3
      Re: clear/reset the bounded fields in a form

      On May 20, 10:19 am, Salad <o...@vinegar.c omwrote:
      karsagar...@gma il.com wrote:
      I have a bounded form and after I click the button to update/save. THe
      fields are still there. Is there a way to clear off the fields in the
      bounded form.
      >
      Thanks,
      SA
      >
      Here's the code that I have:
      >
      Private Sub cmdSave_Click()
      On Error GoTo Err_cmdSave_Cli ck
      >
          Dim Response
          DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
      acMenuVer70
          Response = MsgBox("The component has been successfully
      updated !!", vbOKOnly, "Component Updated")
      >
      Exit_cmdSave_Cl ick:
          Exit Sub
      >
      Err_cmdSave_Cli ck:
          MsgBox Err.Description
          Resume Exit_cmdSave_Cl ick
      >
      End Sub
      >
      I don't get it.  When you save a record, do you want it to clear the
      values of that record?  Then you save it and overwrite it?
      >
      Bound means associated to a table's records via the control's data source.
      >
      You could move to another new record.  Maybe want you want to do is open
      the form in DataEntry mode (under DataTab in Form's property sheet)
      >
      Also see the GoToRecord method/action in help.
      >
      Shoulder Holsterhttp://www.youtube.com/watch?v=2CgBr5h YumE- Hide quoted text -
      >
      - Show quoted text -
      Actually this is a cosmetic plus avoiding errors. I do not wish to
      over write. What I want is to clear the fields in the form (but the
      problem is that it is bounded ). So is it possible to make the fields
      in a from appear empty/clear/reset after the save operation. Which
      works perfectly well.

      Comment

      • Salad

        #4
        Re: clear/reset the bounded fields in a form

        karsagarwal@gma il.com wrote:
        On May 20, 10:19 am, Salad <o...@vinegar.c omwrote:
        >
        >>karsagar...@g mail.com wrote:
        >>
        >>>I have a bounded form and after I click the button to update/save. THe
        >>>fields are still there. Is there a way to clear off the fields in the
        >>>bounded form.
        >>
        >>>Thanks,
        >>>SA
        >>
        >>>Here's the code that I have:
        >>
        >>>Private Sub cmdSave_Click()
        >>>On Error GoTo Err_cmdSave_Cli ck
        >>
        >> Dim Response
        >> DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
        >>>acMenuVer7 0
        >> Response = MsgBox("The component has been successfully
        >>>updated !!", vbOKOnly, "Component Updated")
        >>
        >>>Exit_cmdSave _Click:
        >> Exit Sub
        >>
        >>>Err_cmdSave_ Click:
        >> MsgBox Err.Description
        >> Resume Exit_cmdSave_Cl ick
        >>
        >>>End Sub
        >>
        >>I don't get it. When you save a record, do you want it to clear the
        >>values of that record? Then you save it and overwrite it?
        >>
        >>Bound means associated to a table's records via the control's data source.
        >>
        >>You could move to another new record. Maybe want you want to do is open
        >>the form in DataEntry mode (under DataTab in Form's property sheet)
        >>
        >>Also see the GoToRecord method/action in help.
        >>
        >>Shoulder Holsterhttp://www.youtube.com/watch?v=2CgBr5h YumE- Hide quoted text -
        >>
        >>- Show quoted text -
        >
        >
        Actually this is a cosmetic plus avoiding errors. I do not wish to
        over write. What I want is to clear the fields in the form (but the
        problem is that it is bounded ). So is it possible to make the fields
        in a from appear empty/clear/reset after the save operation. Which
        works perfectly well.
        I'd simply close the form.

        You give absolutely no reason for clearing the fields. You've given no
        indication in your response that you are moving to another record.

        Maybe what you could do, instead of clearing the fields, is to enable or
        disable controls based on the "state" of the record. Or lock the fields
        depending on the state so the data isn't modified. (Locked and Enabled
        are under the data tab).

        Enable Locked Edit?
        Y N Y
        Y Y N
        N N N
        N Y N

        Gene & Eddie

        Comment

        • karsagarwal@gmail.com

          #5
          Re: clear/reset the bounded fields in a form

          On May 20, 11:12 am, Salad <o...@vinegar.c omwrote:
          karsagar...@gma il.com wrote:
          On May 20, 10:19 am, Salad <o...@vinegar.c omwrote:
          >
          >karsagar...@gm ail.com wrote:
          >
          >>I have a bounded form and after I click the button to update/save. THe
          >>fields are still there. Is there a way to clear off the fields in the
          >>bounded form.
          >
          >>Thanks,
          >>SA
          >
          >>Here's the code that I have:
          >
          >>Private Sub cmdSave_Click()
          >>On Error GoTo Err_cmdSave_Cli ck
          >
          >   Dim Response
          >   DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
          >>acMenuVer70
          >   Response = MsgBox("The component has been successfully
          >>updated !!", vbOKOnly, "Component Updated")
          >
          >>Exit_cmdSave_ Click:
          >   Exit Sub
          >
          >>Err_cmdSave_C lick:
          >   MsgBox Err.Description
          >   Resume Exit_cmdSave_Cl ick
          >
          >>End Sub
          >
          >I don't get it.  When you save a record, do you want it to clear the
          >values of that record?  Then you save it and overwrite it?
          >
          >Bound means associated to a table's records via the control's data source.
          >
          >You could move to another new record.  Maybe want you want to do is open
          >the form in DataEntry mode (under DataTab in Form's property sheet)
          >
          >Also see the GoToRecord method/action in help.
          >
          >Shoulder Holsterhttp://www.youtube.com/watch?v=2CgBr5h YumE-Hide quotedtext -
          >
          >- Show quoted text -
          >
          Actually this is a cosmetic plus avoiding errors. I do not wish to
          over write. What I want is to clear the fields in the form (but the
          problem is that it is bounded ). So is it possible to make the fields
          in a from appear empty/clear/reset after the save operation. Which
          works perfectly well.
          >
          I'd simply close the form.
          >
          You give absolutely no reason for clearing the fields.  You've given no
          indication in your response that you are moving to another record.
          >
          Maybe what you could do, instead of clearing the fields, is to enable or
          disable controls based on the "state" of the record.  Or lock the fields
          depending on the state so the data isn't modified.  (Locked and Enabled
          are under the data tab).
          >
          Enable  Locked  Edit?
             Y       N       Y
             Y       Y       N
             N       N       N
             N       Y       N
          >
          Gene & Eddiehttp://www.youtube.com/watch?v=afkfos_ oQro- Hide quoted text-
          >
          - Show quoted text -
          Thanks a lot. I think this would work for me. I could lock or disable
          the control. My reasononing for wanting to do this was because when
          the user modifies the field(s) in the form and then clicks the Update
          button. The controls still have the data and it is hard to say if
          anything even happened. Also there is a chance of data being modified
          unintentionally by the user by exiting from the form or moving around
          with the record navigation bar

          Thanks.

          Comment

          • Salad

            #6
            Re: clear/reset the bounded fields in a form

            karsagarwal@gma il.com wrote:
            On May 20, 11:12 am, Salad <o...@vinegar.c omwrote:
            >
            >>karsagar...@g mail.com wrote:
            >>
            >>>On May 20, 10:19 am, Salad <o...@vinegar.c omwrote:
            >>
            >>>>karsagar... @gmail.com wrote:
            >>
            >>>>>I have a bounded form and after I click the button to update/save. THe
            >>>>>fields are still there. Is there a way to clear off the fields in the
            >>>>>bounded form.
            >>
            >>>>>Thanks,
            >>>>>SA
            >>
            >>>>>Here's the code that I have:
            >>
            >>>>>Private Sub cmdSave_Click()
            >>>>>On Error GoTo Err_cmdSave_Cli ck
            >>
            >>>> Dim Response
            >>>> DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, ,
            >>>>>acMenuVer7 0
            >>>> Response = MsgBox("The component has been successfully
            >>>>>updated !!", vbOKOnly, "Component Updated")
            >>
            >>>>>Exit_cmdSa ve_Click:
            >>>> Exit Sub
            >>
            >>>>>Err_cmdSav e_Click:
            >>>> MsgBox Err.Description
            >>>> Resume Exit_cmdSave_Cl ick
            >>
            >>>>>End Sub
            >>
            >>>>I don't get it. When you save a record, do you want it to clear the
            >>>>values of that record? Then you save it and overwrite it?
            >>
            >>>>Bound means associated to a table's records via the control's data source.
            >>
            >>>>You could move to another new record. Maybe want you want to do is open
            >>>>the form in DataEntry mode (under DataTab in Form's property sheet)
            >>
            >>>>Also see the GoToRecord method/action in help.
            >>
            >>>>Shoulder Holsterhttp://www.youtube.com/watch?v=2CgBr5h YumE-Hide quoted text -
            >>
            >>>>- Show quoted text -
            >>
            >>>Actually this is a cosmetic plus avoiding errors. I do not wish to
            >>>over write. What I want is to clear the fields in the form (but the
            >>>problem is that it is bounded ). So is it possible to make the fields
            >>>in a from appear empty/clear/reset after the save operation. Which
            >>>works perfectly well.
            >>
            >>I'd simply close the form.
            >>
            >>You give absolutely no reason for clearing the fields. You've given no
            >>indication in your response that you are moving to another record.
            >>
            >>Maybe what you could do, instead of clearing the fields, is to enable or
            >>disable controls based on the "state" of the record. Or lock the fields
            >>depending on the state so the data isn't modified. (Locked and Enabled
            >>are under the data tab).
            >>
            >>Enable Locked Edit?
            > Y N Y
            > Y Y N
            > N N N
            > N Y N
            >>
            >>Gene & Eddiehttp://www.youtube.com/watch?v=afkfos_ oQro- Hide quoted text -
            >>
            >>- Show quoted text -
            >
            >
            Thanks a lot. I think this would work for me. I could lock or disable
            the control. My reasononing for wanting to do this was because when
            the user modifies the field(s) in the form and then clicks the Update
            button. The controls still have the data and it is hard to say if
            anything even happened. Also there is a chance of data being modified
            unintentionally by the user by exiting from the form or moving around
            with the record navigation bar
            >
            Thanks.
            Here's a routine that might help. Under the Other tab there's a row
            called Tag. I put in the word EnDis for those records I want to
            enable/disable. Then I call the subroutine like
            EnableDisable False 'disable
            EnableDisable True 'enable
            So in your Save button code you'd use EnableDisable False. And in the
            Add or Edit button EnableDisable True.


            Sub EnableDisable(b lnEnDis As Boolean)
            Dim ctl As Control
            For Each ctl In Me.Controls
            If ctl.Tag = "Endis" Then ctl.Enabled = blnEnDis
            Next
            End Sub

            Going On

            Comment

            Working...