save MDB file through forms?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ontherun
    New Member
    • Mar 2007
    • 55

    save MDB file through forms?

    Hi All,

    I know this might be a silly question to ask but i was just wondering,
    is there a way to save a specific MDB file , which is accessed from the server,
    in to the local machine in a specific folder.

    It will be good if there is a way so that the user can create a backup of the database they use into the local machine before they close.

    is there any way or any other similar operation that could do this task???!!!!

    thanks and regards,
    catherine
  • JConsulting
    Recognized Expert Contributor
    • Apr 2007
    • 603

    #2
    Originally posted by ontherun
    Hi All,

    I know this might be a silly question to ask but i was just wondering,
    is there a way to save a specific MDB file , which is accessed from the server,
    in to the local machine in a specific folder.

    It will be good if there is a way so that the user can create a backup of the database they use into the local machine before they close.

    is there any way or any other similar operation that could do this task???!!!!

    thanks and regards,
    catherine
    Hi Catherine,
    There are always ways....but as in all things, there's a why involved here. Chances are if your database is on a server, it's already being backed up. As developers, we put our databases in central locations so the users don't end up creating their own that we'd eventually have to merge back into the original. I think my peers here back me up when I say it's a bad idea. If your user has a requirement to have a backup, then perhaps it's a more pointed request than backing up the whole database. Check with the administrators of the server to see if backups are being done already.

    If you still feel you should complete this request, then you must make sure that the user has permissions to get to the database location, and it's a simple copy after that. It's a very bad idea to copy an open database, so this action should take place outside of the database that you want to copy. That also means that no one else should be in it either.

    Maybe you should consider a batch file that you can run that copies the database. This type of file can be programmed into a scheduler and run at regular intervals.

    There's a lot to your request...so if you require specific help on any of this, please let us know.
    J

    Comment

    • ontherun
      New Member
      • Mar 2007
      • 55

      #3
      Originally posted by JConsulting
      Hi Catherine,
      There are always ways....but as in all things, there's a why involved here. Chances are if your database is on a server, it's already being backed up. As developers, we put our databases in central locations so the users don't end up creating their own that we'd eventually have to merge back into the original. I think my peers here back me up when I say it's a bad idea. If your user has a requirement to have a backup, then perhaps it's a more pointed request than backing up the whole database. Check with the administrators of the server to see if backups are being done already.

      If you still feel you should complete this request, then you must make sure that the user has permissions to get to the database location, and it's a simple copy after that. It's a very bad idea to copy an open database, so this action should take place outside of the database that you want to copy. That also means that no one else should be in it either.

      Maybe you should consider a batch file that you can run that copies the database. This type of file can be programmed into a scheduler and run at regular intervals.

      There's a lot to your request...so if you require specific help on any of this, please let us know.
      J
      Hi J,

      Thanks for your reply. I spoke to my Admin and i came to know they have not set up the server to have backups but he will do it some time soon. (strange..i dunno when!!)

      but as of now what i am doing is, before leaving the office every night, i am keeping a copy of the db in my local machine.

      I hope if the server is scheduled for backups, then i dont have to do this. I am just curious to know is there anyway to do this operation by any means, if the user has full access permission over the db??!!

      regards,
      Catherine

      Comment

      • JConsulting
        Recognized Expert Contributor
        • Apr 2007
        • 603

        #4
        Originally posted by ontherun
        Hi J,

        Thanks for your reply. I spoke to my Admin and i came to know they have not set up the server to have backups but he will do it some time soon. (strange..i dunno when!!)

        but as of now what i am doing is, before leaving the office every night, i am keeping a copy of the db in my local machine.

        I hope if the server is scheduled for backups, then i dont have to do this. I am just curious to know is there anyway to do this operation by any means, if the user has full access permission over the db??!!

        regards,
        Catherine
        Is the old click and drag option not available to you? Are you looking for some kind of script or copy command thinking that you can push a button and be done?

        Like I said, if you're in the database that you want to backup, then you'll end up with corruption.
        J

        Comment

        • kathnicole
          New Member
          • Mar 2007
          • 33

          #5
          May be ontherun should use scheduling software to save the mdb file in the respective folder.

          Comment

          • JConsulting
            Recognized Expert Contributor
            • Apr 2007
            • 603

            #6
            Originally posted by kathnicole
            May be ontherun should use scheduling software to save the mdb file in the respective folder.

            [code=vb]
            If you feel you're all right with saving when you close still, create a small function

            Put it into a CODE module.

            Function SaveBackEnd()
            Dim strSavePath, strSaveFile, strNowPath as string
            strSavePath = "C:\Databas e\" ' the directory where you want to save your back end
            strNowPath = "C;\Wherever\My Backend.mdb" ' the directory where your back end is now
            strSaveFile = "MyBackend_ " & format(date()," mmddyyyy") & ".mdb"
            filecopy strNowPath, strSavePath & strSaveFile
            end function

            Now in your on_close event of your switchboard, call the function

            SaveBackEnd

            [/code]

            Comment

            • kathnicole
              New Member
              • Mar 2007
              • 33

              #7
              Originally posted by JConsulting
              [code=vb]
              If you feel you're all right with saving when you close still, create a small function

              Put it into a CODE module.

              Function SaveBackEnd()
              Dim strSavePath, strSaveFile, strNowPath as string
              strSavePath = "C:\Databas e\" ' the directory where you want to save your back end
              strNowPath = "C;\Wherever\My Backend.mdb" ' the directory where your back end is now
              strSaveFile = "MyBackend_ " & format(date()," mmddyyyy") & ".mdb"
              filecopy strNowPath, strSavePath & strSaveFile
              end function

              Now in your on_close event of your switchboard, call the function

              SaveBackEnd

              [/code]
              I must try this out as well.

              Comment

              • ontherun
                New Member
                • Mar 2007
                • 55

                #8
                Originally posted by kathnicole
                I must try this out as well.
                Hi ,
                i saved the as in the module and called from on_Close event..
                but it doesnt do anything i mean, there is no mdb file saved in the directory i specified nor a error message.

                the code was,

                Privare Sub Form_Close()

                SaveBackEnd - module

                End Sub


                MODULE:

                Function SaveBackEnd()

                Dim strSavePath, strSaveFile, strNowPath As String

                strSavePath = "C:\Testing DB\"

                strNowPath = "C:\Documen ts and Settings\Admin\ Desktop\PriceLi st.mdb"

                strSaveFile = "MyBackend_ " & Format(Date, "mmddyyyy") & ".mdb"

                FileCopy strNowPath, strSavePath & strSaveFile

                End Function

                Instead, i used this code on button click: but i got a error message saying, Expected Variable or procedure not a module.

                need your assistance

                regards,
                catherine

                Comment

                • JConsulting
                  Recognized Expert Contributor
                  • Apr 2007
                  • 603

                  #9
                  Originally posted by ontherun
                  Hi ,
                  i saved the as in the module and called from on_Close event..
                  but it doesnt do anything i mean, there is no mdb file saved in the directory i specified nor a error message.

                  the code was,

                  Privare Sub Form_Close()

                  SaveBackEnd - module

                  End Sub


                  MODULE:

                  Function SaveBackEnd()

                  Dim strSavePath, strSaveFile, strNowPath As String

                  strSavePath = "C:\Testing DB\"

                  strNowPath = "C:\Documen ts and Settings\Admin\ Desktop\PriceLi st.mdb"

                  strSaveFile = "MyBackend_ " & Format(Date, "mmddyyyy") & ".mdb"

                  FileCopy strNowPath, strSavePath & strSaveFile

                  End Function

                  Instead, i used this code on button click: but i got a error message saying, Expected Variable or procedure not a module.

                  need your assistance

                  regards,
                  catherine

                  is this verbatim?

                  [code=vba]
                  Privare Sub Form_Close()

                  SaveBackEnd - module

                  End Sub
                  [/code]

                  take out the - module

                  so its just SaveBackEnd

                  you inserted the code into a new module right? You didn't save the module SaveBackEnd by chance did you? if you did, you can't name a module and function the same..rename your module to mod_SaveBackEnd

                  J

                  Comment

                  • ontherun
                    New Member
                    • Mar 2007
                    • 55

                    #10
                    Originally posted by JConsulting
                    is this verbatim?

                    [code=vba]
                    Privare Sub Form_Close()

                    SaveBackEnd - module

                    End Sub
                    [/code]

                    take out the - module

                    so its just SaveBackEnd

                    you inserted the code into a new module right? You didn't save the module SaveBackEnd by chance did you? if you did, you can't name a module and function the same..rename your module to mod_SaveBackEnd

                    J
                    I didnt include the word module in the code. however i saved the module as mod_SaveBackEnd and called the function under Form_Close() function.
                    but when i tried to close , it says permission denied.

                    then i tried 2 call the function under Quit Button Click.
                    but nothing happens and the my file was not saved in the folder i specified.

                    is there any other step am missing here???
                    need your assistance.

                    regards,
                    Catherine

                    Comment

                    Working...