Solved

Questions Copying Front End of Access database to users' desktops using MS DOS Batch File.

Posted on 2010-09-13
7
622 Views
Last Modified: 2013-11-28
I have split an Access 2007 database and was given the following code, which is supposed to copy the front end to the user's desktop. Please help me to understand this code, so that I can tweak it to apply it to my situation. The code is as follows:

Echo OFF
IF NOT EXIST "\\xxxxxxfps01\Home\%USERNAME%" GOTO server07
Mkdir "\\xxxxxxfps01\Home\%USERNAME%\Catalog\"
IF EXIST "\\xxxxxxfps01\Home\%USERNAME%\Catalog" DEL "\\xxxxxxfps01\Home\%USERNAME%\Catalog\*.*" /Q
XCOPY "\\xxxxxxfps01\Catalog\Front End\PMCatalog_09132010.mdb" "\\xxxxxxfps01\Home\%USERNAME%\Catalog\" /I
START "Catalog" /MAX "\\xxxxxxfps01\Home\%USERNAME%\Catalog\PMCatalog_09132010.mdb"
Exit
:server07
IF NOT EXIST "\\xxxxxxfps01\Home\%USERNAME%" GOTO server06
Mkdir "\\xxxxxxfps01\Home\%USERNAME%\Catalog\"
IF EXIST "\\xxxxxxfps01\Home\%USERNAME%\Catalog" DEL "\\xxxxxxfps01\Home\%USERNAME%\Catalog\*.*" /Q
XCOPY "\\xxxxxxfps01\Catalog\Front End\PMCatalog_09132010.mdb" "\\xxxxxxfps01\Home\%USERNAME%\Catalog\" /I
START "Catalog" /MAX "\\xxxxxxfps01\Home\%USERNAME%\Catalog\PMCatalog_09132010.mdb"
Exit
:server06
Mkdir "\\xxxxxxfps01\Home\%USERNAME%\Catalog\"
IF EXIST "\\xxxxxxfps01\Home\%USERNAME%\Catalog" DEL "\\xxxxxxfps01\Home\%USERNAME%\Catalog\*.*" /Q
XCOPY "\\xxxxxxfps01\Catalog\Front End\PMCatalog_09132010.mdb" "\\xxxxxxfps01\Home\%USERNAME%\Catalog\" /I
START "Catalog" /MAX "\\xxxxxxfps01\Home\%USERNAME%\Catalog\PMCatalog_09132010.mdb"
Exit

Question 1: \\xxxxxxfps01\Home\%USERNAME%"
Does this path refer to the user's Desktop? xxxxxxfps01 is the server name.

Question 2:
I want the front end to be copied to a folder 'Catalog' on the user's desktop. How is this coded?

Question 3:
I want the .mdb, PMCatalog_09132010.mdb, to reside in a folder 'Catalog' on the G: drive, which is xxxxxxfps01. How is this coded?
0
Comment
Question by:newbie46
  • 3
  • 2
  • 2
7 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 250 total points
ID: 33668615
to refer to the user Desktop
"C:\Documents and Settings\%username%\desktop\"

'create the Catalog directory on the user desktop

mkdir  "C:\Documents and Settings\%username%\desktop\Catalog"
' copy the front end

copy  "\\xxxxxxfps01\Catalog\Front End\PMCatalog_09132010.mdb" "C:\Documents and Settings\%username%\desktop\Catalog\PMCatalog_09132010.mdb"
0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 250 total points
ID: 33669278
simple explanation

Echo Off = dont display output
IF NOT EXIST = if directory doesnt exist goto the label server07 and run the code from there
Mkdir = create directory
IF EXIST ... DEL = if file exists then delete
XCOPY = copy
START = run in a seperate window

the sample code has home directories in a different place to normal

you can get to it like cap says or you can use USERPROFILE, this should be set. You can confirm this by typing in SET from the dos command

The above should answer q1

In reality one call should do it as xcopy can create the directory structure if it does not exist

eg   xcopy "C:\temp\a" "%USERPROFILE%\Desktop\Catalog\" /e /y

will copy the contents of folder c:\temp\a to USERPROFILE\Desktop\Catalog
so if userprofile is c:\documents and settings\fred it would equate to

copy contents of c:\temp\a to c:\documents and settings\fred\Desktop\Catalog

I prefer the use of directories as it is then open to copy more files without having to change the code

That should answer q2

and finally q3, well simple replace c:\temp\a with your folder where the mdb resides, no need to specify filenames


0
 

Author Comment

by:newbie46
ID: 33672365
I'm not having any luck, so I'm starting with the basics. I'm trying to get the following statements working.

Echo on
mkdir  "C:\Documents and Settings\kloskoc\Desktop\Catalog"
copy  "C:\Documents and Settings\kloskoc\Desktop\MPPB Database\PMCatalog_09132010.mdb" "C:\Documents and Settings\kloskoc\Desktop\Catalog"
Exit

The black command prompt window comes up quickly and then disappears, but the file is not copied. What could be the problem?

Thanks.



Exit
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 119

Expert Comment

by:Rey Obrero
ID: 33672420
you did not include the file on the destination folder

Echo on
mkdir  "C:\Documents and Settings\kloskoc\Desktop\Catalog"
copy  "C:\Documents and Settings\kloskoc\Desktop\MPPB Database\PMCatalog_09132010.mdb" "C:\Documents and Settings\kloskoc\Desktop\Catalog\PMCatalog_09132010.mdb"
Exit
0
 

Author Comment

by:newbie46
ID: 33673611
I cut and paste the statements from your last comment above into the Batch file. The black command prompt window still comes up quickly and disappears. It is displaying the message,  "The system cannot find the file specified." Is the extension the issue? Removing the extension, it still cannot find the file.
Any ideas?
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 33673641
are you sure the file from the Source folder?

"C:\Documents and Settings\kloskoc\Desktop\MPPB Database\PMCatalog_09132010.mdb"
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 33674425
where is your original mdb file? is it in the g drive? if so then source file would be from the g drive
remember what I said about xcopy, it creates the directories for you
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

919 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

20 Experts available now in Live!

Get 1:1 Help Now