I would like to create a module that will take a few of my tables in my database and back them up into a new database on one of my servers every day. The name and path of the database will change day by day based on the date. Can someone recommend some code...I tried this:
Dim strmydir As String
strmydir = "\Jxflpr4DataDepartmentOps TechRaw Builder ArchiveArchived" & Format(Date, "YYYY-MM") & ""
If Dir(strmydir, vbDirectory) = "" Then
MkDir "\Jxflpr4DataDepartmentOps TechRaw Builder ArchiveArchived" & Format(Date, "YYYY-MM") & ""
ElseIf Dir(strmydir, vbDirectory) <> "" Then
End If
But it doesn't seem to want to copy the tables over. I tried separating the bottom half into a new function, but it still seems to be stopping for no apparant reason. It's not giving an error message, just bringing the debugger up on the second copyobject line.
Is there a better way to do this as I'm aware this code is very messy.
Not sure where this question must be posted! I would like to create code in VBA to backup tables in access. I am not sure where to begin, but what I would like to do is the following:
When the user signs in I want to backup the database/tables When the user sign off I want to back up the database/tables.
I have this code that backs up all my tables in the same folder.I want to however back up only specified table with names; operational areas, Communities, Zones and Projects.how to integrate that into my existing code or any other way to achieve that
Sub backup() Dim dTime As Date On Error Resume Next dTime = InputBox("Create a backup at", , Time + TimeValue("00:00:05"))
Ok I've been reading on backing up Dbs here. I have a db FE and BE I need to do back ups currently I backing up my FE with the autocompact db found in the sample forum but can't use it to back up my BE when it's open.
bascialy I'm trying to backup the BE daily but how do I do it if some is in it?
I recently created a database with an FE and BE, and I want to be able to back up the BE from the FE. In the FE, I added a menu item "Back up database...", and it works good for the FE, but I want it to back up the BE, where the data is located. The reason that I like the menu item is that it opens a "Save Backup As" dialog box, and it also adds the date to the name of the database. Also it will be easier for the people that are using the db.
I was thinking of an idea to backup the database in a multiuser (FE/BE) environment, without disturbing the users. Please comment on it as if it has any drawbacks.
And also soemeone please help me do this, if its does not contain drawbacks.
************************************************** ******** Main Idea
What I want is to automate backup process at fixed intervals, in a FE/BE environment without disturbing the users i.e without disconecting the users. And I think it is possiblke and safe to do if we start the backup process when all users are inactive and stop any user activity or stop Frontend's interaction to the Backend, while in the backup process.
And If no such time is available as all users are inactive within a certian time then forcefully stop user interaction to the backend and start backup process.
To stop user interaction with the backend , we can close all objects (forms, reports, queries etc) and open an unbounded modal pop-up form , with no close exit button. This form can have timer and after 30 seconds or maybe 1 minute we can auto close this form so that the user can again use the application. We can stop new logons by placing an ini file in the folder where the Backend rsides. This Ini file can contain two keys ( "lock time" and "lock status"). At the frontend startup we can query these value from the inifile to check that new logons are allowed or not, and if the "lock time" is greater than 2 minute then bypass the lock status and allow new logons. It means that something went wrong with the last backup process and the ini file was not updated to new lock status. We can have a table or an in file store the normal and maximum time at which the backup process starts. These values can be queried and compared with the current time using a hidden form. If the normal time exeeds the current time then start looking for a state where all logged on users are inactive (i.e all objects are closed in the front end of all users). If such a state is found then warn the user that backup is going to start in 1 minute, lock new logons, after 1 minute close all open objects and then bring up a modal form that i have described in step 1 and start bakup process. And if no state is fount till the maximun time then warn all users that backup would start in 1 minute, lock new logons, after 1 minute close all open objects and then bring up a modal form that i have described in step 1 and start bakup process After the backup is complete set allow new logons in the inifile.
I'm having trouble with some code to backup my database. I thought I'd just have some code call a batch file that copies the backend to a new location. The problem is that when I call the batch file, it opens and runs from c:documents and settings\%username%, so the relative paths in my batch file do not work.
Is there a way to have access tell run the batch file from command prompt in it's actual location? Or maybe it would be better just to copy the back end from within the VBA code. But I don't know how to do that, either. Maybe there's a way to use the Backup Database function under Tools/Database Utilities? With Sendkeys maybe? (but I don't know the code to do it).
i have a db which is split into frontend and datatables, what i need to do is place a command button on the switchboard which allows me to backup the second part of the db. then if needed i need to be able to restore the datatables to the original location so there is no loss of data. if anyone can help this would be most appreciated. i know there is a few threads out there ref data backup but i've been unable to locate any answers
what would possibly cause a "Backup Database As" dialogue box to appear? it's the same as the "save as" box and allows you to save a copy of the access file you're working on but it says "Backup Database As" at the top.
it seems to come up periodically and im not sure what might be causing it.
I have a small mdb database that I archive every week, usually during the archive I delete all the forms expect (logon, switchboard, and three others) and keep the tables, queries, and reports. (use the forms to only enter data, which are not needed for the archive and deleting them reduces the file size)
is it possible to have something in vb, - that will run if its Friday 5pm - will backup the data base to a location on a mapped drive, - with a given file name mmddyy_data.mdb, - and have all but the 5 forms (mentioned above) deleted
I created a database in Access and of course password protected the backend version. As a matter of course I backed up the mdb to cd in case of emergency.
Our network has been taken down due to some virus being bought in by a laptop user so I wanted to reinstall the mdb from the cd to my c: drive.
The problem is that the file is saying that it is 'Read Only' which I think is down to the password protection i put on there.
Question: Is there a way I can get round the security?
I have searched the forums and I know that you can backup data in Access to Excel or another database. What I was wondering was if there was some way to backup your data to a backup file that you could import into another copy of the database on another computer (not on network). What are the options here?:confused:
I read a lot of threads and some KB articles before this, but am still confused.
Can a copy of the BE database be made on the Server while users are logged on ? Max No. of users is 7.
Does copying a BE while work is going on lead to corruption in the database. Right now i make a copy of the database thru code and then compress the copy for a backup.
I have a front end MDE and a backend MDB. From the front end using Visual Basic I want to be able to backup, compact and repair my database. If anyone can point me in the right direction it would be appreciated.
I have a restore from BackUp form. When the form is activated it runs this code
Code: Private Sub Form_Activate() Dim strRestore As String strRestore = "C:GungogManagerBackUp" If Len(Dir(strRestore, vbDirectory)) = 0 Then MsgBox ("There are no BackUp files available"), vbOKOnly Me.btn_Restore.Enabled = False
[code]...
It was working, but since adding the bit in red its not working. I basicly want it to look for the directory and if it dosent find it the pop up with message, but if the dir does exist then to populate the combo.
I am using the following code to backup the tables on my "D" Drive..I want to add a code by which it not only save backup on my drive but also send these files to my email address XYZ@gmail.com
Dim CurrentDay As String Dim CurrentMonth As String Dim CurrentYear As String CurrentDay = Day(Now) CurrentMonth = Month(Now) CurrentYear = Year(Now)
We are currently running a FE / BE splitted database abd would like to back the back end up (to a sepearate location) every 15 minuutes by using the On Timer event.
Troiuble is, I believe I cant use the CopyDataBaseFile method whilst other users are in it and it would be too much hassle kicking everyone off!
Manually copying and pasting is good, but would really like to crack this one
I need some advice for an ASP.NET web application I am working on. I am trying to automate the making of a new table within a database and then have all records from an old table migrated to the newly made table. I would like this task to run from the scheduled tasks on the server in the way of an .exe
The new table would be created on the first day of every month, taking the name of that month. I was thinking to use an empty template table which already has all the fields, and then making a copy and renaming it to the current month.
After the new table has been created I need to copy all the records from the table that represents the previous month over to the new table that represents the current month.
Hi I have had a look on the forum but cannot find what I am looking for!! I need to back up all the contents of the tables of a database in a certain folder and then restore it. The reason for all this is to be able to update the database with new features so that the final user can receive the update and restore the data. How can I achieve this??? M
I've searched for ages looking for threads on backing up a database, and even found one which was asking exactly what I need but without solutions given.
I have a split database with BE and FE, which is used by about 20 users. When the last user closes the database I would like the database to be automatically backed up (e.g. when no one is using it). I've found threads on scheduling a backup, it the middle of the night for example, and other threads on backing up while users are logged on, but I'm not really keen to use these approaches.