473,385 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Split database front end back end

489 256MB
I've split my database so have a front end and back end. Now my question is if a user decides to install the application on a different drive than C: which is where the back end of the database shows is the a way in VBA to take care of the situation?
Thanks
Dec 30 '16 #1
10 1346
gnawoncents
214 100+
There are a number of different ways to do this, depending on your scenario. Each of these events would be triggered by a form that loads in the background at startup and checks for broken links to the back end tables.

1) If the front end and back end will always be positioned relative to each other, you can use VBA to get the path of the front end and append whatever extra path needed from there and use that to relink your tables.

2) If there is no way to know where they will place the front end in relation to the back end, you can have them manually select the location by using VBA to pull up the file picker and use that location to relink your tables.

Like I said, there are plenty of other ways to do this, but these are two of the simplest.
Dec 30 '16 #2
CD Tom
489 256MB
Thanks for the quick reply. I like the option 1 but have no idea how to do this. Do you have some examples of how I can accomplish this.
Dec 30 '16 #3
PhilOfWalton
1,430 Expert 1GB
An approach that I use (It's a bit more complicated that what I shall describe here) is this.

In the FRONT End, create a table that has all the computer names that will use the program and the corresponding paths to the BE databases.

This function will give the name of the current computer.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Private Declare Function apiGetComputerName Lib "kernel32" Alias _
  5.     "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
  6.  
  7. Function fOSMachineName() As String
  8.     'Returns the computername
  9.  
  10.     Dim lngLen As Long, lngX As Long
  11.     Dim strCompName As String
  12.  
  13.     lngLen = 16
  14.     strCompName = String$(lngLen, 0)
  15.     lngX = apiGetComputerName(strCompName, lngLen)
  16.     If lngX <> 0 Then
  17.         fOSMachineName = Left$(strCompName, lngLen)
  18.     Else
  19.         fOSMachineName = ""
  20.     End If
  21.  
  22. End Function
  23.  
Basically when staring the database, have a startup form that runs code to
1) Detach all the tables
2) Find out the current computer name using the above function.
3) Read the table to find the path
4) Verify the path exists using the Dir() function
5) Link the tables

Phil
Dec 30 '16 #4
CD Tom
489 256MB
I don't want to sound dumb but there are some more questions. When you say all computer names, I'm not sure if you mean just the names of the front end and back end or what, and what paths do I put in the table. Also how do I detach all tables, this is something I've never done before.
Like I said before this is all new to me, so thanks for the help.
Dec 30 '16 #5
gnawoncents
214 100+
Phil's solution is valid and will work so long as you know in advance where the back end will be relative to each computer (unless I'm missing something).

This might work perfectly for you, but we would need to know your type of setup first. If, for example, you will have only one copy of the front end for each copy of the back end, and the back end resides in a subfolder from where the front end is installed, you could use the code below to determine the path.

Expand|Select|Wrap|Line Numbers
  1.     Dim strTablePath As String
  2.     strTablePath = CurrentProject.Path _
  3.     & "\Tables\Name of Your Back End.accdb"
  4.  
In this example, the user can drop the folder anywhere they want, so long as the folder containing the Front End has a subfolder (named "Tables" in this case) containing the Back End.

Again, this might not suit your needs at all, but the right solution for you will depend on how and where your users are installing the database and whether or not you have any control over the process.
Dec 30 '16 #6
CD Tom
489 256MB
I use the standard package option that comes with Access 2007 developer. Both the front end and back end are installed in the same directory. If the user decides to put the application in say the D: drive and my program has the back end linked on the C: drive. I need to be able to relink the back end to the D: drive in order for the program to find the back end.
Dec 30 '16 #7
jforbes
1,107 Expert 1GB
There's some relinking code that might be helpful: Working with Front and Back-Ends
Dec 30 '16 #8
PhilOfWalton
1,430 Expert 1GB
Sorry, I wasn't clear on my post. My assumption is that a FE database (and the table I mentioned) is sitting on each computer.

The Computer name can be found by typing
? fOSMachineName
in the immediate window.

So that is the name of the computer the FE is residing on.
Thereafter the BE database holding the tables can be on any computer you like including the same computer, a network computer, Dropbox etc.

Phil
Dec 30 '16 #9
CD Tom
489 256MB
I was looking at the link Working with front and Back End. I can probably get this to work. Here's what I would like to do. After the installation of the program when the user first opens the program I would check to see if the BE is located on the same drive as the FE (this is how the installation puts them). If the linked BE shows the C: drive and the program is located on the D: drive then the program would re-link the BE to the current location on the D: drive. If everything is OK then the program opens with no re-linking. So the re-link would only happen if the program was installed on a different drive than C:
I hope this makes sense and thanks again for all help.
Dec 30 '16 #10
CD Tom
489 256MB
Ok, I found a way to do this, seeing I already had a re-link section in the program with just a few modifications I was able to do exactly what I wanted. So now no matter which hard drive the program is installed in the program will automatically link the BE with the database. Thanks for all the help and suggestions.
Dec 31 '16 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Corey Burnett | last post by:
I have a client that has a split database (front-end/back-end). They are also using Access security - MDW file. The front end MDE file, the back end MDB file, and the MDW file are all located on...
13
by: Larry L | last post by:
Access is noted for bloating a database when you add and delete records frequently. I have always had mine set to compact on close, and that works great. Now after everyone's advice I split my...
2
by: raydelex | last post by:
I have a split database (Access 2003). Now I need to port the database to the end-users' computer for a demonstration. When I try to start up the database on the other computer, it tells me...
11
by: Daveo | last post by:
Hi there, Since splitting my database, one form in particular takes about 10 times as long to load and refresh, compared to the unsplit version on the server. The code behind it contains 36...
4
by: carriolan | last post by:
Hi I have managed to secure a split database. Both frontend and backend share a common workgroup, common security groups and common users and permissions, but as in all good stories there is a...
1
by: andymcintosh85 | last post by:
Hi all, I have a split database which i designed on my work computer, i have copied the database onto my home computer. When i try to open the front end i get the error message that the...
3
by: najimou | last post by:
Hi everyone I will be having a split database, running on 2 computers via mapped drive. computer "A" will have one front end and the back end located in c: \mydatabse 2 tables have links to...
3
by: theProfessor | last post by:
We are using a shared split database with all users currently using Access 2003. The back end is on a shared drive of a state wide WAN. Each user has a copy of the front end on their local...
5
by: rhonda6373 | last post by:
Good morning, I have a client that has sent me a database that is already split. I have not worked with a split database before. He wants me to make the changes and then re-import data from...
3
by: Shawn29316 | last post by:
I have a split database and I need to replace one of the data tables in the back end weekly. I'd like to have the user who gets the new data file each week to replace the old file but I don't really...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.