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

Status
Not open for further replies.

jhirsch

IS-IT--Management
May 28, 2004
8
0
0
US
I was having problems with my db on a shared network. It was corrupted and even after being repaired multiple times a day the problme would recur.

I have re built the db and I plan on splitting it this time and creating a bat file. How do you create the bat file? Help with this would be great as well as any other tips to help prevent the db from corruption.

Thanks!!!!
 
What is the BAT file going to do??? Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
A bat file to do what? Open the code file? Or repair? I wouldn't invest time in a utility to repair it, I'd find out why and prevent it.
If you are getting repetitive corruptions, either your network is incredibly slow and/or disconnecting, or a user is crashing the file somehow. Have you interviewed the users who were in just before crashing to see what they did?
 
sorry about that,

I want a bat file that runs each time a user opens the program and makes a copy of the Server FrontEnd, places the copy on the users local hard drive, opens that local copy and connects to the server BackEnd.

thanks!
 
I agree with "NewPoster". Fix the problem, don't look for ways around it. How are users shutting down the application? If they are doing it wrong, it can cause the DB to get corrupted. There are other things that can cause it, and it is always better to find the cause and resolve it than to make a work around... Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
I am already working with all the users to make sure they use the db properly, especially shutting down the app.

But like I said, I am going to split it and someone on another post suggested to create a .bat file making a copy of the FrontEnd on their local PC, opening it and connecting to the backend table. The db only has one table and three forms, and a bunch of reports run off queries. It is pretty simple.

I just have never created a .bat file so I do not know how or where to begin. I am trying to fix the problem here and am not just looking for a way around it.

Thank You
 
i don't have the problem your refering to... but how many users are using this front end?? if you have to many that can some times cause a problem with to many people in the one file...

i have a bat file that i use to copy the current front end to the local users pc each time they run it, and it load's access with the database... here's what i use...

@echo off
mkdir c:\local_dir
copy "\\compname\shared_dir\db.mde" c:\local_dir
rem this next line got cut in two, sorry.
start "c:\program files\microsoft office\office\msaccess.exe" c:\local_dir\db.mde


I put quotes around certain things so that windows can use em that way... without the quotes a doss command shell can't understand it...

I hope this helps... i also make sure that since it's being stored on the users local pc, that it's an mde so they can't realy change any thing:)

--Junior[fumanchu]


Junior1544@yahoo.com
Life is change. To deny change is to deny life.
 
You do not need a batch file. In fact, you do not even need the Front end on the user's PC. As long as they all have a network mapping to the directory where the two ends are stored, just drop a shortcut their desktop pointing to the front end.

There are other, more elegant ways as well, such as each user having his/her own front end, but if the FRONT END is fairly static (e.g. users don't create their own queries or reports or other nonsense like that) there's no harm in them sharing the same front end.

Ex-JimAtTheFAA
78.5% of all statistics are made up on the spot.
Another free Access forum:
More Neat Access stuff at
 
If the batch file is created to copy and open the frontend locally, if someone does shut down illegally will/can the db on the shared drive still get corrupt?

Also, I have never used .bat files before. Thank you and I understand what needs to be done but where do I put:

@echo off
mkdir c:\local_dir
copy "\\compname\shared_dir\db.mde" c:\local_dir
rem this next line got cut in two, sorry.
start "c:\program files\microsoft office\office\msaccess.exe" c:\local_dir\db.mde

Thank you all for the great feedback

JH
 
if someone does shut down illegally will/can the db on the shared drive still get corrupt?

Possibly. Just ask Murphy. [evil]

In case you don't know, I'll go over each line:

REM Turns off local echo of the DOS commands as they're executed.
[red]@echo off [/red]

REM Creates a directory (folder) on the local Hard drive. If folder already exists, will generate an error, but continue anyway.
[red]mkdir c:\local_dir [/red]

REM Copies the named file from the network shared directory to the (new) directory on the users local drive
[red]copy "\\compname\shared_dir\db.mde" c:\local_dir [/red]

REM kicks off Access and loads the file just copied
[red]start "c:\program files\microsoft office\office\msaccess.exe" c:\local_dir\db.mde [/red]

The problem with this batch file is that the user will be prompted EACH TIME after the first run of it, whether or not to OVERWRITE the file that's already in the new directory from last time they ran the copy. Annoying, but not a deal-breaker.

You can put this batch file pretty much anywhere, in the ROOT of C:\, in the C:\PROGRAM FILES folder, even on the desktop itself.. Place a shortcut to it on the desktop, and then change these properties for it, to make it a little cleaner:

1) Right click the shortcut icon, and select PROPERTIES
2) Look for the RUN option, and set it to run MINIMIZED. Cuts down on screen clutter.
3) Also, look for the option for "Close on Exit" and make sure it is checked ON - this will destroy the instance of DOS that the batch file started, cause you don't need it any more once the batch file has run. It wouldn't hurt to add the line QUIT to the end of the batch file either...




Ex-JimAtTheFAA
78.5% of all statistics are made up on the spot.
Another free Access forum:
More Neat Access stuff at
 
BTW, since you seem a bit confused about the BAT files. Copy this code to a notepad window.

@echo off
mkdir c:\local_dir
copy "\\compname\shared_dir\db.mde" c:\local_dir
rem this next line got cut in two, sorry.
start "c:\program files\microsoft office\office\msaccess.exe" c:\local_dir\db.mde

I don't think you need the MKDIR command run everytime, but I guess it won't hurt to insure that it is there. You could also add the following line before the copy:

DEL /Q "c:\local_dir\db.mde"

This will delete the existing version of the front end prior to copying the new one in place. This would remove the "prompt to replace" that Jim (WildHare) mentioened.

Click the File Menu -> Save As... Select the location you want to save it to and give it a name (MyDB.BAT). Then follow Jim's suggestions of copying to the desktop, etc...

Hope that helps... Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
Thanks, i forgot to put that in there... i use a batch file to copy the db to the local pc for my users so that when i make an update, i don't need to worrie about telling every one to logoff when i do it... just makes it easier for me to do updates and changes... i'm looking into replication and having a static local mdb bringing up a networked mdb upon login... but the bat file works for me:)

--Junior Junior1544@yahoo.com
Life is change. To deny change is to deny life.
 
Thanks, The help has been great and I know am starting to understand Batch files.

For all users to get the .bat file. Can I just send it in an email and make sure they save it in the same location as defined in the file. Then have them create the shortcut?

Lastly, I couldn't find the option to "close on exit"

Thanks!
 
you can send the bat file to their email, but where they put it doesn't realy matter, because that's just a list of dos command line commands (that sounds odd:))... i have my users put it right on their desktop... that way they just double click it and it does all the work... i've also changed the icon of it so it looks like an access icon:)

--Junior Junior1544@yahoo.com
Life is change. To deny change is to deny life.
 
Just a little side note here. We use a bat file to roll out to 450 users ever time they open the app. Works good. We do it because of access's tendancy to grow. If you want to stop the rewrite prompt just delete the old version of the app before you copy down the new version.
 
A more seemless way to do it, is to run the batch file on the user's login script. This way, each day when they log in, the version on the server will automatically be copied to their hardrive. The user will never be asked to do anything.

The only downside, is if you are making changes throughout the day, which my only response would be: in a producion environment, if you are making multiple changes per day, then you have a bigger issue.

You can change the version anytime you want, and the next time that person logs into the network, they get the latest version. We use this system, and it works great. It takes the least amount of work from all involved. Jim Lunde
compugeeks@hotmail.com
We all agree your theory is crazy, but is it crazy enough?
 
I think I am almost there, I'm just now trying to fine tune the db for a multi user environment.

This is what I have currently, please let me know of any suggestions:

"Default record locking" - Edited record
"Open db with record-level locking" checked

Any suggestions for the Refresh Interval, # of update retries, Update retry interval, ect. values?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top