Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Design a desktop button to copy a file from the server? 1

Status
Not open for further replies.

gusbrunston

Programmer
Feb 27, 2001
1,234
US
[tt]
Hi:

I sit at my computer enhancing the front end of a database. When there is a significant difference with the new version, I upload the new front end to the server at the office. The name of the server is "TrelServer." The file goes into the following path: "c:\Datamaster\Database\". The file name is TrelComp.mdb, so

"C:\Datamaster\Database\TrelComp.mdb" on TrelServer. The users have been deleting their old front ends and getting the new front end from the server by clicking on NetWork Places, selecting the network place, (\\TrelServer\Datamaster\Database), then selecting and copying the file, "TrelComp.mdb".

The new front end has the same links to tables because I use the same path on my development box at home.

This works o.k., but I'd like to put an button on their desktop that would automate this.

The button would close and delete the present front end. Then it would access the server and copy the new front end to their stations.

I've almost got this done, but I need to know how to (in Access) reference the database file on the server. I've tried several formats, and can't find the right one. When I use the following I get an error "Compile error. Type mismatch." I have a reference to DAO3.6 in the reference list.

Dim db As Database
set db = "[\\TrelServer\Datamaster\Database\TrelComp.mdb]"

What is the correct way to reference an external database?

Any help very much appreciated!

Cheers, [glasses][tt] Gus Brunston - Access2000(DAO)[/tt] Intermediate skills.
 
what about running a batch file that copies the file after you have closed the database with VBA? Or, you could give a batch file that is executed instead of the database front end...this batch file would make a copy of the most current version and then open it?

When you reference the external database, unless you want to open it and run things inside of it, I don't believe you need to declare it as a database, rather you would use the path & name which would likely be a string.

So to copy a file in VBA it's like this:
Code:
dim strOriginalFile as string
dim strNewFile as string

strOriginalFile = "c:\mydirectory\myfile.mdb"
strNewFile = "c:\newdirectory\newfile.mdb"

FileCopy strOriginalFile, strNewFile

Hope that helps-
-Dan


 
[tt]
Dear TheVillageInn:

Thanks. Using your suggestion I've tested it as much as I can with some success on my home box.

Tomorrow I will test it on the network.

Again, thank you. [glasses][tt] Gus Brunston - Access2000(DAO)[/tt] Intermediate skills.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top