Solved

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

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Article by: Lee
Windows 7 Ultimate and Enterprise (and 2008 R2) introduced a new feature you may not be aware of - Boot from VHD.   Boot from VHD (or what Microsoft refers to asNative Boot allows you to install Windows to a VHD (Virtual Hard Disk) file that is t…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

786 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