Solved

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

Posted on 2011-09-06
5
296 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

OfficeMate Freezes on login or does not load after login credentials are input.
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

763 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