Return browser file path and TransferDatabase

BrokenBiker

ManicMechanic
Local time
Yesterday, 18:30
Joined
Mar 22, 2006
Messages
128
I've recently made some updates to the database at work. I need to get these updates to the other users to meet current regulations. Our database here at work is used by several other off-station sites. Normally, I just type out a long list of detailed instructions (stating that most people are clueless about Access is an understatement) and hope that nobody messes up.

While digging through the site here I came across a few things that have slipped by me. Namely, DeleteObject, Rename, and TransferDatabase.

So, I made up a bit of simple code and put it in a form so the other sites can just import the form and open it up and everything happens auto-magically. I tested it out here w/ some copies of the working database and everything is working smooth (after a few hiccups.)

The problem is that these other sites' administrators are going to have to paste the location of the updated file that I send them.

Code:
DoCmd.TransferDatabase acImport, "Microsoft Access", "t:\WhateverFolder\UpdatedDBName.mdb", acReport, "ReportName", "NEWReportName", False

There are probably about 20 of these lines. That's a lot of cut-and-pasting to update the file-path.

I was wondering if there's a way to use the same kind of function in the attachment for returning a file path to the line of code using the browsing function?

Thanks y'all,
BB

P.S. I believe (but can't quite remember) I got the original design for the browser from Ghudson's sample db.
 

Attachments

re:

Hi,
use this code to open the standard File Open/Save dialog...use a variable to store the returned path e.g.:

Dim strFilter As String
Dim lngFlags As Long
Dim strPath As String

strFilter = ahtAddFilterItem(strFilter, "Access Files (*.mda, *.mdb)", _
"*.MDA;*.MDB")
strPath = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Select File!")

Then use that variable in your transferdatabase methods e.g.:

DoCmd.TransferDatabase acImport, "Microsoft Access",strPath, acReport, "ReportName", "NEWReportName", False

However, wouldn't it be much simpler to use a split application meaning you have a frontend holding forms/reports/modules/queries and a backend holding tables/data. Each user would get a copy of the frontend which link back to the ONE backend on the sever. If you need to make changes to the frontend then do so and just redistribute it. Keep in mind that this is the prefered set up of a multi user environment which prevents corruption and performance issues.
HTH
Good luck
 
I'll try the code out and see if I can get things working on it. I can't use the FE/BE because the other users...well, maybe "users" is a bad word choice. There are other units at separate locations using this db and they're not connected by any shared network. Someday...I'll try to get "spun up" on how to make an on-line db, either through access or a SQL server, but for now, Access is it.

I could just have the other locations create a folder on the C:drive and have them save the file there. That way the file directories would all be the same, but our computer admin guys are the only ones that have the right to write to the C:drive. That can lead to some coordination problems that I'd rather avoid if possible. You know, keep things as simple as possible for the user.

At any rate, I figured it'd be a "Dim filename As String" kinda thing, but I'm new at creating my own code for this. Thanks for the help. I'll post back at my next stopping point. Hopefully, I'll get it working.
 
re:

You're welcome.
Let me know if you hit any walls and I'll try to help you further.
Good luck on future projects!
 
Whoo! It's done!

I actually was able to get it to work both with the code you provided and w/ Ghudson's browsing example. I decided to go w/ the code you provided because it only needs the one module and it'll be easier for the other sites to use.

Basically, I'm going to have to give them instructions on how to import the module and the form, then they just use the form and everything else is auto-magic!

Thanks again:cool:

----------------------------------
Key words: Rename Delete acImport TransferDatabase Browse
 

Attachments

re:

No problemo...glad you got it sorted out.
HTH
Good luck
 

Users who are viewing this thread

Back
Top Bottom