473,396 Members | 1,703 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,396 software developers and data experts.

Avoid message "Could not find file... database_path"

759 512MB
Hello !

"Could not find file... database_path"
This message appear if a front end database could not find the back end database.

I have a form set as StartUp form. I try to put code in associated events (On_Load and On_Open) to intercept the error but it seems that no code is running either before either after that message appear.

Is it possible to treat this error ? Simple I wish to show a message like "Reconnect your interface to the database, please" instead the default message.

Thank you !
Nov 28 '11 #1
12 13075
TheSmileyCoder
2,322 Expert Mod 2GB
Its been a while since I've since this error.
Does it have a number?
Nov 28 '11 #2
Mihail
759 512MB
No. It hasn't a number. It is only a message.

Change the name for a back end database (where you have tables) then try to open a front end based on this tables. You will see the message.

Of course, if you restore the old name all is Ok again.
As far as I can think, that is a message from the database engine (JET ???).
The question is: can be intercepted in order to run code to handle this error ?

Thank you for interest, Smiley !
Nov 28 '11 #3
NeoPa
32,556 Expert Mod 16PB
In my tests this error message is only triggered when an access is attempted to one of the linked tables. I suspect you have something running automatically that includes such an access.

You should try checking this as a first step in your code. Relinking ODBC Tables using VBA should have all the information you need for this, but let us know if you need anything explained.
Nov 28 '11 #4
TheSmileyCoder
2,322 Expert Mod 2GB
Im unsure as to whether the exact error message can be trapped.

There are 2 situations here to consider, the one your describing where you rename the backend can be handled by this:
You need a startup form that does NOT bind to a recordset (because if it does, access will try to load it, causing said error) that runs the following code:
Expand|Select|Wrap|Line Numbers
  1. If Dir("G:\MyPath\MyDB.mdb") & ""="" Then
  2.   Msgbox "BackEnd not found"
  3.   Docmd.Quit 'Or whatever you want
  4. end If

I have a similar problem, which the above would not solve, namely that when users go to lunch their computers go in standby mode and apparntly so does their network adaptor (im guessing) and when they return they get said error message (or something similar) and have to restart the tool. Annoying.

So Im hoping your problem fits into the first category.
Nov 28 '11 #5
NeoPa
32,556 Expert Mod 16PB
Smiley:
I have a similar problem, which the above would not solve, namely that when users go to lunch their computers go in standby mode and apparntly so does their network adaptor (im guessing) and when they return they get said error message (or something similar) and have to restart the tool. Annoying.
Why not post on that and we can look at possible ways of getting around it. I suffer from that too sometimes and it may be worth spending some time designing a professional way to handle it (Even if it's only to warn the user in a friendly way and ensure that the database is re-opened). Not in this thread though of course ;-)
Nov 28 '11 #6
Mihail
759 512MB
Thank you, both, for answers.

Yes: the start up form is bind to a table.
I'll try Smiley code and I return here to inform you about results.

Thank you again !
Nov 28 '11 #7
NeoPa
32,556 Expert Mod 16PB
In that case make your startup form a separate, unbound, form that does the checks and immediately opens the original form if, and only if, everything is ok. Otherwise it handles whatever you need at that point.
Nov 28 '11 #8
Mihail
759 512MB
Hi, again.

Smiley !
Every time I receive code from you, I can use it with no modifications. So I am pretty sure that your code is correct and functional. But I don't try it because I understand that it is not what I am looking for.

It is not useful for me to check IF or IF NOT the back end part is stored in a certain folder under a certain name.

Let me explain why:
On my own computer the back end part is in a folder MyPath\BackEnd.mdb
I link the front end part to the BackEnd.mdb , so MY front end part look in MyPath to find BackEnd.mdb

First reason, but not the main reason:
I don't wish to force the user to use the same path structure as me and the same name for the BackEnd.mdb as me.
So, if the user use another path than me (or another name for the back end part, or both), your code will show the message "BackEnd not found" even if the front end is linked to the back end and all is ok.

The main reason:
The back end part is stored on a computer and the front end part run from different computers in the same network.
So it has no utility to check if the back end is in a certain location.

The main main :) reason:
I don't like to use TeamViewer to relink front end part to the back end part whenever I add a feature to one of the front end part (there are three)

So the first question remain:
How to intercept the error message in order to handle it.
Or, in a boolean logic, how to know if the front end is properly linked to the back end BEFORE the error raise ?

Ufff. I think that I use all the English words I know.
Thank you for the patience.
Nov 28 '11 #9
Mihail
759 512MB
I remember some unused English words, NeoPa :)

I know how to relink a database from VBA. Starting with this code I wish to design a wizard.
But when I must run this wizard ?
Nov 28 '11 #10
NeoPa
32,556 Expert Mod 16PB
Mihail,

Smiley's code just about does all that you ask. The only exception I can see is that it assumes you already know the location of the file that your tables are linking to. If you don't then (assuming you know at least one of your tables that links to the back-end file - and if you don't then you probably need to give up now :-D) you can get the value from :
Expand|Select|Wrap|Line Numbers
  1. Split(CurrentDb.TableDefs("XXX").Connect, "=")(1)
where [XXX] is the name of the linked table.

From there you have already been told how to arrange the forms such that this is tested before it falls over, and Smiley's code would be used (with the minor amendment here) in the Form_Open() event procedure of that form.
Nov 28 '11 #11
Mihail
759 512MB
Only two line of code between me and happiness !!!

First half from you, NeoPa and the second from you, Smiley

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. Dim ExpectedPath As String
  3.     ExpectedPath = Split(CurrentDb.TableDefs("Noduri").Connect, "=")(1)
  4.     If Dir(ExpectedPath) & "" = "" Then
  5.         MsgBox "BackEnd not found"
  6.     Else
  7.         DoCmd.Close acForm, Me.Name
  8.         DoCmd.OpenForm "StartingFormName"
  9.     End If
  10. End Sub
I'll put this code on the first form of the wizard.
If all is Ok the wizard will be close (line 7) and the first form of the front end part will be opened (line 8).
If not the wizard continue and show it's first form.

THANK YOU, both, VERY MUCH !
Nov 28 '11 #12
NeoPa
32,556 Expert Mod 16PB
Great :-) All sorted now.
Nov 28 '11 #13

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

Similar topics

3
by: Bush is a Fascist | last post by:
As an experiment I wrote a simple C program that invokes PHP using system(), but I'm getting an error "No input file specified.". What I do is: setenv ("REQUEST_METHOD", "GET", 1); setenv...
1
by: PeterB | last post by:
Hi! I'm using Pure ASP File Upload (http://www.asp101.com/articles/jacob/scriptupload.asp) to upload a file from a client to a server. I am testing both on a local IIS and a remote server. The...
4
by: Mike S | last post by:
I'm hoping someone can explain the following. I have installed Visual Studio 2003. Setup several web application projects, compliled and ran them with no problem. All of this was accomplished...
1
by: Pat | last post by:
I received this message when loading a web form that was working before. I rebuilt the project, but still could not get past this error. So, I basically copied the FILENAME.aspx.vb code and...
4
by: Joe Lester | last post by:
I'm trying to figure out what the optimal Postgres configuration would be for my server (with 200 connecting clients, even though I'd really like to get it up to 500). I've got a 700 MHz eMac...
9
by: Tristán White | last post by:
Hi I am very new to PHP - actually, this is my second day at it, as I've only recently started a new job last week. We're a charity. I have a "No input file selected" problem. A Google search...
3
by: news.microsoft.com | last post by:
Who knows what it means when a Windows XP Pro SP2 produces a transient error window from aspnet_state.exe saying "instruction at reference to memory at . memory could not be read." every time it...
1
by: .Net Sports | last post by:
I'm using Persits.upload module in ASP, and when i use the following form pointed to the object I've always used, i get a "The system cannot find the file specified" error pointing to the line of...
1
by: Zhuo Li | last post by:
I am using VS2005. The "Edit|Find and replace" dialog won't pop up when you try to find something (tried short cuts like: CTRL-F too, no luck). Does anybody know how to bring this dialog back. ...
6
by: =?Utf-8?B?U2NvdHQgVHJpY2s=?= | last post by:
I followed the instructions from MSDN for Webclient UploadFile and I get an error: Could not find file 'C:\testfile.xls'. If I add the file (c:\testfile.xls) to the server I do not get the error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.