Results 1 to 7 of 7

Thread: auto saving to access database

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2008
    Posts
    25

    auto saving to access database

    I have a datagrid that is bound via a datasource to an access database , i want the gird to autosave to the row changed in the gird to the database without clicking the save button in the toolbar that appears when you drag a datagrid onto a form , can anyone tell me how this is achievable , or even better a small simple downloadable project that I can have a look at
    thanks

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: auto saving to access database

    You could use a timer control set at some interval like 5 minutes. Then in its timer event procedure you could call the .PerformClick event of the save button.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2008
    Posts
    25

    Re: auto saving to access database

    hmmm thanks , I mean when you leave the row that you are editing then the row you have been editing gets saved without having to press the save button
    do you know how this is achievable

  4. #4
    Fanatic Member Clanguage's Avatar
    Join Date
    Jan 2008
    Location
    North Carolina
    Posts
    659

    Re: auto saving to access database

    Use the rowLeave event to save the row.
    vb Code:
    1. Private Sub DataGridView1_RowLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.RowLeave
    2.  
    3.     End Sub
    CLanguage;
    IF Post = HelpFull Then
    RateMe
    Else
    Say("Shut UP")
    End If
    DotNet rocks
    VB 6, VB.Net 2003, 2005, 2008, 2010, SQL 2005, WM 5.0,ahem ?OpenRoad?

  5. #5
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: auto saving to access database

    You could use the IsRow Dirty on RowLeave to Call the update
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jul 2008
    Posts
    25

    Re: auto saving to access database

    hi thanks for the replies this is what I am looking for
    but could you help me a bit more with the code
    so using

    Private Sub DataGridView1_RowLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.RowLeave
    'then see if row is dirty - this is the bit I am stuck on
    if isrow dirty then
    'call save button click event
    end if

    End Sub
    the bit I am having a problem with is finding out if the row is dirty or not as isrow dirty is not compiling , what is the syntax for finding out if the row is dirty in this sub routine ?
    thanks

  7. #7
    Fanatic Member Clanguage's Avatar
    Join Date
    Jan 2008
    Location
    North Carolina
    Posts
    659

    Re: auto saving to access database

    This should do it for you
    Code:
            If DataGridView1.IsCurrentRowDirty Then
    CLanguage;
    IF Post = HelpFull Then
    RateMe
    Else
    Say("Shut UP")
    End If
    DotNet rocks
    VB 6, VB.Net 2003, 2005, 2008, 2010, SQL 2005, WM 5.0,ahem ?OpenRoad?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width