Database connection

Anishtain4

Registered User.
Local time
Today, 00:32
Joined
Apr 13, 2011
Messages
21
I use this method to connect to my data base:

Code:
dim db as DAO.Database
Dim rst as DAO.RecordSet
......
set db=currentdb
set rst=db.openrecordset(SQL)
.....

and I splitted the database, but when I put that on the server it wanted to use tables on the address they were on my hard drive, then I relinked the front end to the back end again it was tring to use database on the address of the server like D:\blah blah

so I tried to import the tables from the back end and then split it again, that worked. but that is disgusting, how can I make it easier? for example assume that I update some forms and want to let other people let them use, what should I do?

how should I change the line currentdb to make it constant whenever I change the front end? and where should I declare a global variable so when I change the location of back end in one place and I get it all through my forms?
 
You should use UNC path naming, rather than drive letter path naming, for the path to the back end. So the path would look like;

'\\ServerName\FolderName\YourFileName


instead of;

D:\FolderName\YourFileName

That way when you distribute copies of the front end to other users there will be no need to modify the path on their workstation. When you split the db, if you use My Network Places (or Network - whatever it's called in your version of Windows) to navigate to the back end folder you will get UNC path naming.

If you change the location of the back end folder, then you will need to update each copy of the front end to reflect the new path. This can be done manually using the built in Linked Table Manager, but would need to be done separately on each copy. There are some utilities out there that can be used to automatically keep your front end copies up to date. I haven't been invited to the "circle of trust" here yet, so I can't post a link, but just Google for "ms access auto front end updater".
 
As my code above declares I haven't used any drive letter, I just used simply currentdb and when I link tables to the backend they does not update however in link manager path are correct!!!!

I need some other method to connect my database to front tend rather than "set db=currentdb"
 

Users who are viewing this thread

Back
Top Bottom