Results 1 to 8 of 8

Thread: Access Database Saving

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2013
    Location
    United Kingdom
    Posts
    123

    Question Access Database Saving

    Hello!

    I have done a bit of searching around but can't seem to find anyone who has asked a simular question.

    Everything works, I can add a new entry to my database and save it. Close the debug, reopen it and the entry will still be there. The issue comes when I open the actual database in the project file with Access, it doesn't show the new entries, and if I run the debug again - the new entries that had been saved before are gone.

    It's as if by opening the Access Database the database is put back to how it was before Visual Studio got a hold of it? I would like to be able to open the database in case anything ever needs to be changed within the database that cannot be done though my program.

    Here's my code for the "add new" and "save" buttons (and "next" & "previous"):

    Code:
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Try
                SettingsBindingSource.EndEdit()
                TableAdapterManager.UpdateAll(LMDatabase)
                MsgBox("Saved")
            Catch ex As Exception
                MsgBox("Error While Saving")
            End Try
        End Sub
    
        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            SettingsBindingSource.AddNew()
        End Sub
    
        Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
            SettingsBindingSource.MoveNext()
    
        End Sub
    
        Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
            SettingsBindingSource.MovePrevious()
        End Sub
    Thanks in advance
    VS 2017 - Need as much help as you can give (write it all for me!)

  2. #2
    Fanatic Member
    Join Date
    Aug 2004
    Location
    Essex, UK
    Posts
    774

    Re: Access Database Saving

    Where are you storing the database file (.mdb or .accdb)? You might be seeing some kind of virtualisation. You should not store the database in the app folder. Store it in a folder in ProgramData or the user's local appdata folder.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2013
    Location
    United Kingdom
    Posts
    123

    Re: Access Database Saving

    Quote Originally Posted by paulg4ije View Post
    Where are you storing the database file (.mdb or .accdb)? You might be seeing some kind of virtualisation. You should not store the database in the app folder. Store it in a folder in ProgramData or the user's local appdata folder.
    Its stored as a local copy which Visual Studio decided the location itself. And its an .accdb - is it simply because it isn't a published version?
    VS 2017 - Need as much help as you can give (write it all for me!)

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Access Database Saving

    In my signature, there's a link "I swear I saved my data, where'd it run off to?" ... click, read, decide if it's your case... (hint, it probably is)

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2013
    Location
    United Kingdom
    Posts
    123

    Re: Access Database Saving

    Quote Originally Posted by techgnome View Post
    In my signature, there's a link "I swear I saved my data, where'd it run off to?" ... click, read, decide if it's your case... (hint, it probably is)

    -tg
    It's in the bin! So it is just a debug quirk.

    Thanks <3
    VS 2017 - Need as much help as you can give (write it all for me!)

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Access Database Saving

    It's not a quirk. It's by design... so that you don't muck up your design database with test junk or accidentally send your db into a bad state.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Oct 2013
    Location
    United Kingdom
    Posts
    123

    Re: Access Database Saving

    Quote Originally Posted by techgnome View Post
    It's not a quirk. It's by design... so that you don't muck up your design database with test junk or accidentally send your db into a bad state.

    -tg
    Smart, it's like they know what they are doing and I don't
    VS 2017 - Need as much help as you can give (write it all for me!)

  8. #8
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Access Database Saving

    hahaha... there's a reason I have a link to that post... it comes up a lot. A. Lot.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Tags for this Thread

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