how will i know when a user modifies a record?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nev
    Contributor
    • Oct 2007
    • 251

    how will i know when a user modifies a record?

    i have a bunch of databound controls on my form. and i have a modifiedbytextb ox also. if a user changes anything in the record,

    modifiedbytextb ox.text = s_username.

    which control & event can i place that code?

    i tried placing it in...
    bindingsource_c urrentchanged --> nope
    bindingsource_c urrentitemchang ed --> nope
    bindingsource_l istchanged --> nope
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    How the user modifies a record ?

    Comment

    • nev
      Contributor
      • Oct 2007
      • 251

      #3
      Originally posted by debasisdas
      How the user modifies a record ?
      thank you for replying. i know i can use the textchanged on every boundtextboxes i have on my form. but i was wondering if there is something like...

      if bindingsource.i sedited then
      'log modified by
      end if

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        It will be better to use an Edit option.

        When the user clicks on edit only then they can make changes to the content and here you can set which user modified it.

        Comment

        • nev
          Contributor
          • Oct 2007
          • 251

          #5
          thank you, i will consider that option.

          Comment

          • Shashi Sadasivan
            Recognized Expert Top Contributor
            • Aug 2007
            • 1435

            #6
            I think the datatable object has the method HasChanges()
            which returns a bool value.

            Comment

            • nev
              Contributor
              • Oct 2007
              • 251

              #7
              Originally posted by Shashi Sadasivan
              I think the datatable object has the method HasChanges()
              which returns a bool value.
              thank you i will look into jthat.

              Comment

              • nev
                Contributor
                • Oct 2007
                • 251

                #8
                dataset has the haschanges() method and i tried it but did not work correctly. i cannot use the textchanged() event of each necessary control also because they are bound controls and when a user scrolls to each record, that event will be fired which will treat the record as modified even if the user only scrolled to that record. i'm still thinking to use an edit button as my last option because i don't want users to be required to click a button in order to modify a record.

                what should i do and which event to use?

                Comment

                • Shashi Sadasivan
                  Recognized Expert Top Contributor
                  • Aug 2007
                  • 1435

                  #9
                  Does not work correctly?

                  Could you please give an example when it does not work, maybe then you could submit a bug to microsoft then

                  Comment

                  • nev
                    Contributor
                    • Oct 2007
                    • 251

                    #10
                    Originally posted by Shashi Sadasivan
                    Does not work correctly?

                    Could you please give an example when it does not work, maybe then you could submit a bug to microsoft then
                    for hascchanges to work, do i have to iterate through all the rows and check if each row haschanges? so, if i have 3,000 rows do i have to check each row 1 by 1? or can i just get all the rows that has changed then iterate through them to put the modifiedby name?

                    Comment

                    • nev
                      Contributor
                      • Oct 2007
                      • 251

                      #11
                      and to add, was i correct? the dataset is the only thing that has the haschanges method? i need to know please. thank you.

                      Comment

                      • nev
                        Contributor
                        • Oct 2007
                        • 251

                        #12
                        here is the code i used that doesn'st work. i placed this in my save button:

                        if dataset.haschan ges() then
                        msgbox("boom!")
                        end if

                        i run the program and edited a field then clicked the save button. i expected the msgbox to pop but it didn't. so i concluded that it doesn't work.

                        Comment

                        • nev
                          Contributor
                          • Oct 2007
                          • 251

                          #13
                          is anyone here willing to help a poor soul?

                          Comment

                          • nev
                            Contributor
                            • Oct 2007
                            • 251

                            #14
                            ooohhh... i need to bindingsource.e ndedit() before checking dataset.haschan ges()

                            Comment

                            Working...