Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bat file to update database. 1

Status
Not open for further replies.

Junior1544

Technical User
Apr 20, 2001
1,267
0
0
US
I have a database that is split between front end and back end... I want to have the user run a batch file instead of just loading a link to the database. this batch file will copy the latest vertion of the database front end to the local pc... i want to do it this way since i am constantly making changes to the database, and when ever i make a change i need to do it in an off line vertion and then wait for every one to go home... by this time, i'm already half way done with another change and forget to put it in place where the link goes to... but with a batch file i wouldn't have to worrie about any thing... the users are running off of a local vertion and i can update all day... i also think it will increase the server speed if that much less is being pulled off of it... just the one time when they load it... i've gotten it to work pretty good myself, but the mail problem is that the dos window stay's open untill the person exit's out of the database... any idea's on how to get it to close??

here's my batch file:

@echo off
copy f:\db.mde c:\db_dir
call c:\progra~1\micros~2\office\msaccess.exe c:\db_dir\db.mde
exit


The last two lines are suposed to be one, it just line wraped:)

thanks all... Junior1544@yahoo.com
Life is change. To deny change is to deny life.
 
Just as an idea, you might want to check out Replication. I don't know much about it, but from what I've heard, it will "push" the new frontend to all of the clients PCs. Of coarse, the batch file seems to do the trick fine too. Not sure if it'll work, but try using "start" rather then "call" to open the MDE.
 
...Also, FYI you don't need to have exit there, just make sure the shortcut is set to exit on close or whatever its called.
 
Start did it, thanks! now i don't have to worrie about my updates any more!!

here, have a medal![medal]

how about a star too, you just saved me a good deal of agrivation. Junior1544@yahoo.com
Life is change. To deny change is to deny life.
 
:) No problem. Also, if you're network setup is on NT/2k/XP (read: NOT 9x/Me), I'd reccomend searching Microsoft.com for a utility they include with their resource kits called ROBOCOPY.EXE. You should be able to find it on the net. Robocopy will allow about 5000 different options, but you'll be interested in its ability to work quite nicely over the network, as an alternative to just copy. It will work well if there are any network problems, and is very flexible.. Check it out. I've used it with a setup similar to yours to copy over a VPN link. HTH
-NT
 
Also, you might want to consider using an NT/2000 login script to update the front end, which will ensure that each morning the users have the most recent production copy of the database, and you don't have your network slammed all day with people copying a front end they may already have.

This solved my front end distribution problems beautifully, and ensures that my users who sometimes open a second copy of the database aren't trying to overwrite the one they're currently using.

Code:
@echo Hello, %USERNAME%, please wait a moment while
@echo your databases are updated from the server.
@echo Thank you for your patience!
@REM First I want to delete the U:\ drive, then remap
@REM it to \\SERVER\pub so I know everyone's mapped
@net use U: /del 
@net use U: \\SERVER\pub

@REM Then I want to copy certain files 
@REM (Access db frontends) from to U:/
@REM to a standard local dir

@copy U:\Access\install\*.* "c:\program files\databases\*.*"

cls

@REM And finally, I want to set the time to
@REM match the server hosting the Access db backends
@net time \\SERVER /set /yes

@REM If we want workstations showing 4 digit years
@reg update "HKCU\Control Panel\International\sShortDate=M/d/yyyy"

exit
 
Also, adding "@echo off" on the first line of the batch file / login script will effectively hide all of the commands from being printed on the screen. Also, you won't need to add an @ before each line to hide the line.
 
To all the experts on how to use batch files - my knoledge in this field is very low and I'd like to learn more about it. Do you have some helpfull links to sites with explanations on the commands that can be used in batch files and other explanations?
 
A batch file is essentially just a list of commands your throwing at the OS. True, there are some advanced things you can do with them, but BAT files are rather simple. If you're just getting started and you use an NT/2K/XP system, then you might want to consider looking into writing .CMD files. These CMD files support all of the old DOS batch file tricks plus add in some nice touches for NT. Of coarse, if you're really sharp, look into Windows Scripting. These are all ways of writing macros to run on a PC. It all depends on how much power and flexiblity you truly need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top