Solved

batch file operation to copy an access database from the server to the user's desktop

Posted on 2011-09-06
5
304 Views
Last Modified: 2012-06-21
Hi:
I am new to all this but I need help with batch scripting in a  Windows XP or Windows 7 environment

If the user logs offs or switches user then:

1.  All instances of msacess.exe is terminated (i.e. all running versions of ms access databases are killed)
2.  Then when the user logs back in (regardless of who the user is....I am assuming putting some autoexecutable file in the "All Users" folder):
      copy the "Service Database_2000.mdb" database file from the location \\zlv010\mfg_test  TO   the user's desktop without any acknowledgment (automatically occurs in the background with no user intervention)
 
0
Comment
Question by:sxxgupta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 14

Expert Comment

by:setasoujiro
ID: 36492444
ok try this:

@echo off
net use x: /delete
net use x \\zlv010\mfgtest
pause 15
copy x:\service_database_2000.mdb c:\documentsandsettings\%username%\desktop

put this in the startupfolder in the xp machine for all users.
or put in registry under run key.

I do however wonder how they will get the file back to the server?
wouldn't it be easier to just create a shortcut to the file using a script once?
0
 
LVL 23

Expert Comment

by:Danny Child
ID: 36493758
I think you may need to be careful with just Killing the msaccess.exe as you may leave Lock files in place on your database (LDB files) which may then prevent others accessing the data.  

And will this lead to multiple versions of your database existing in different locations?  If so, what defines which one is the "right" one?  

Perhaps if you could expand on the problem you are facing, then this would allow us to offer alternate solutions?
0
 

Author Comment

by:sxxgupta
ID: 36495130
I am trying to update the user's access database desktop copies automatically because I make changes to the master copy and then post it on the network.  Then I have to go around telling multiple users to copy over from the network and this becomes laborious.  The question is, if the user copies the database from the network drive while their desktop copy is open, will this "corrupt" their desktop copy?  If it will, then I need to shut down msaccess and then copy over.  

Also, I do not want to delete the network database file as suggested by setasoujiro.
0
 
LVL 14

Accepted Solution

by:
setasoujiro earned 500 total points
ID: 36495163
i didn't suggest to delete the fle , check this:


net use x: /delete >in case x: exists on the pc<
net use x: \\yourserver\yourshare /p:yes  >map the share where the DB is, because you cannot copy from a UNC path in batch<
copy x:\database c:\documentsandsettings\%username%\desktop   >copy the file to desktop<

that's all it does, it does not delete anything... but you'd probably want to delete the local copy everytime the user logs on , because otherwise the copy job will error on duplicate file names.

But again, i don't see why you don't let people open the file from the share itself....
0
 
LVL 5

Expert Comment

by:xylog
ID: 36495410
Why not use access's built-in replication?

http://office.microsoft.com/en-us/access-help/CH006252685.aspx
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question