Solved

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

Posted on 2011-09-06
5
286 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:DanCh99
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

762 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now