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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for Backend

Status
Not open for further replies.

emergencyplan

Technical User
Aug 19, 2003
34
GB
Hello,

I have a database that sits on a number of laptops that are connected to provide a network during an incident. One machine acts as the 'server' and contains the backend of the database to which all of the information is written from the front ends.

I install a front end onto each of the machines and the backend onto only one machine. When the database is opened, I have to manually locate the backend are refresh the links.

I would like to be able to do this automatical, i.e. have the database look for the backend, if it can find it; open a form to prompt the use to browse for a location and then a command button to refresh all of the links once the backend has been located.

I don't know where to start...any ideas out there.

Many thanks,
 
I did something vaguely similar using the FileSearhObject, scanning network paths for the db name.
You'd need to be careful about naming, and having backup copies out there that this function would pick up--maybe have a check of msysobjects for latest update, or some other way for you to verify that "SomeDB.mdb" is in fact the correct and latest version of "SomeDB.mdb", and not the backup copy you made by Ctrl-Dragging the file into some other directory.

Alternatively you could filter a CommonDialog control with certain paths and let them pick one.

--jsteph
 
if you have a local control table add a field called backenddb
or create a local table with a field called backenddb
before you distribute the front end change the value in the field to the name of the data base best with a unc ie:
\\Server\Data\backendData.mdb
and run the following code on startup
Function relink()
dim backenddb as string
dim mydb as database
dim rst as recordset
Dim tds As TableDefs
Dim td As TableDef
connectstr=";DATABASE="& dlookup("backenddb","controltablename")
set mydb=currentdb
set rst=mydb.openrecordset("SELECT MSysObjects.Name FROM MSysObjects WHERE (((MSysObjects.Type)=6));")

Set tds = mydb.TableDefs

With rst
if .recordcount=0 then exit function
.MoveFirst
Do Until .EOF
Set td = tds(!Name)
td.connect=backenddb
td.RefreshLink
.MoveNext
Loop
End With

end function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top