Results 1 to 11 of 11
  1. #1
    Damonpc is offline Novice
    Windows Vista Access 2007
    Join Date
    Nov 2010
    Posts
    4

    Error 3024 At Start UP

    I have a front end database that links to a back end on a server. The server is switched off over the weekend and as such if the fornt end is opened prior to the manual switch on of the server (Windows Home Server) then there is an error 3024 "Could not find the file 'H:\xxxx.mdb'". I have tried to capture using AutoExec but the error fires before that point.

    Is there anyway to capture the error and run code to advise need to turn on server and exit gracefully? I have to go this way as there are no options towake the server.

    MS Access 2007
    Client Windows XP
    Server MS Windows Home Server

    Any help appreciated.



    Damon

  2. #2
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    You could put some code in the OnLoad event of your startup form. Something like:

    Private Sub Form_Load()
    On error goto ErrorOnLoad
    exit sub
    ErrorOnLoad:
    msgbox "There was an error opening this db. Contact dbAdmin. Exiting mdb file.",vbcritical
    docmd.quit
    End Sub

    Otherwise there is code you could write to test to see if the backend tables are connected/linked but the On Error goto would most likely accomplish the same thing.

  3. #3
    Damonpc is offline Novice
    Windows Vista Access 2007
    Join Date
    Nov 2010
    Posts
    4
    Unfortunately the error hits prior to the form load event takes place!
    Last edited by Damonpc; 11-22-2010 at 08:58 PM.

  4. #4
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    I don't typically use an Autoexec macro but instead put any code needed into my Startup form (and then set the StartUp under Utilities to my Startup form name.)

    Otherwise you could put this code...
    Private Sub Form_Load()
    On error goto ErrorOnLoad
    exit sub
    ErrorOnLoad:
    msgbox "There was an error opening this db. Contact dbAdmin. Exiting mdb file.",vbcritical
    docmd.quit
    End Sub

    into the Autoexec macro itself (I'm not sure what the syntax in the macro would be like but the above could easily be coded into a macro.)

    I'd seriously though consider converting/putting your Autoexec macro code into the OnLoad or OnOpen event of the form itself. I never use macros myself anymore. I used to until I found that vba coding into the form design around events (such as OnLoad or OnOpen, etc...) is a LOT easier once you get a little bit familiar with vba coding.

    Otherwise if you absolutely don't want to convert your autoexec macro into vba coding, you'll need to implement the above vba code into your autoexec macro (possibly working with the conditions column in the macro) or rename the autoexec macro to something else, have your form open on Startup, and then call the new macro name to do it's thing in the form's OnLoad event (or in the OnClick event of a button on the form).

  5. #5
    Damonpc is offline Novice
    Windows Vista Access 2007
    Join Date
    Nov 2010
    Posts
    4
    Thanks pkstormy, but it doesn't matter where i put the code the error is triggered befor the open or load event on the start up form!

  6. #6
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    Oh. I think I get it now after I re-read your first post.

    If I'm on base with you now, I'm guessing that you want to find some way to capture if a remote server is on or not so you don't get the "Could not find the file 'H:\xxxx.mdb'" error when trying to open the mdb? Question - Is the Autoexec you're referring to the Autoexec.bat file on the c: drive or the Autoexec macro in the mdb?

    One thing you could possibly try is opening the mdb via a vb script (I have an example in the code bank: https://www.accessforums.net/code-re...sier-7572.html called: The Golden vb script...) I use the vb script in this example for all my users to run to open any mdb since using this technique allows me unlimited users without any issues. I'm guessing you could then put in some code within the vb script to 'ping' the server IP and see what the return is or trap the error in the vb script and then branch within the vb script to a message box saying the server is off or continue and open the mdb.

    If you were referring to the Autoexec maco in the mdb (in which the error is related to not finding the backend table mdb as you've stated), I'd still use a vb script to capture the error before the mdb even opens. I've never tried to run code in the frontend which executes before MSAccess links to the backend mdb tables which is what I'd guess your error is due to. If you were referring to the Autoexec.bat on c:\, I'd just replace the line in that file that opens the mdb to instead run the vb script (you can edit the Autoexec.bat via notepad - make a backup first.) You could also probably edit the Autoexec.bat and possibly put the 'ping' code or error trapping code in that but I think a vb script gives you more coding possibilities (not 100% sure on this though - I mainly use vb scripts to automate miscellaneous pc tasks or php scripts for web type scripts.)

    You could also set the frontend up to prompt for the table location of the backend each time it's opened (but this could become a pain for users.) To do this, you would refresh the linked tables in the front-end and select the 'Prompt for new location' checkbox. Otherwise I'd look at vba code to link the backend tables into the frontend and put this on my startup form so that I could bypass MSAccess's auto-linking to the backend mdb.

    Note also that I had re-searched ways to turn on/shut down a server remotely and ended up trying some utilities to turn the computer on via a MAC address utility. Only problem was I couldn't really automate it. If you're interested, I'd suggest googling 'turn on pc' or 'wake up pc' or 'MAC Address Utility'. I tried several different ones. Be careful though as I was experimenting with shutting down a pc remotely and waking it up. After doing this several times via one of the MAC utilities, I ended up making the hard drive on that pc start clicking and then eventually die.

    I hope this answers your question or helps.

  7. #7
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by Damonpc View Post
    Thanks pkstormy, but it doesn't matter where i put the code the error is triggered befor the open or load event on the start up form!

    I am curious about your setup. I have a FE on a workstation (C:\) with a BE on a Win2003 Server. If I move the BE and try to open the FE, I get an error. I trap it and have the option to select a new location (or different BE) and relink it or quit.

  8. #8
    Damonpc is offline Novice
    Windows Vista Access 2007
    Join Date
    Nov 2010
    Posts
    4
    Firstly pkstormy your guess is correct and the vb solution would work and is doable.
    My autoexec was going to be within access, but like you i prefer the flexibility of vba so would prefer that solution.
    In the scheme of things it is not a big issue, but i am just flumuxed as to how to catch the error when it executes so early. If i put a msgbox in the onload event of the start up form it will only run after i accept the original error message about the backend file not being available.

    Steve
    I am running MS Access 2010, Vista business. FE on desktop (for testing) and BE on Windows Home Server via a maped drive. The error is as described before and the help button provide the code in the title of the post. Start up form contains code to which will not fire until after i cancel the original error message.

    Totally stumped.

  9. #9
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    Damonpc,

    I'm not sure if there is the ability to put in any vba code anywhere to interrupt MSAccess when it makes it's connection to the BE linked tables when the FE is opened (I've never tried). I "think" this might happen before any code is executed if the tables are already linked into the FE. I think that's what you were asking in your original post. I know some developers will link the tables via code (in their startup form) but I typically don't do this. You could find code to do this via googling. If you did take this route, you'd probably want to run the vb script I posted so it would clone a non-linked table source FE mdb (and add code to link the tables in your startup form). Thus users would then run the vb script to open the mdb which would clone/open a source mdb without the linked tables. This way you could capture any problems (ie. on error goto ...) when you link the tables in code.

    Otherwise the only way I can see to capture the error is to some way test the connection within the vb script itself before the mdb is opened.

    It's too bad though you have to store the data on a server which is not 24x7. I personally use a dedicated SQL Server box (and linked SQL Server tables into the FE mdb, then compile to mde for the users) which has worked great for years. I use the vb script also so that I can copy a new source *.mde (compiled) to the folder at any time without having 50+ users close out of the FE. When they run the vb script to open the FE the next time, it will clone from the source with the new coding changes. Makes it easy to make coding changes on multiple applications without the run-around work of having user's close out of the FE to work on or copy new code.

    If you're interested in doing some vb script coding, I'd recommend looking into a product called EXEScript. It very nicely (and easily) converts vb script code into an *.exe file (just the push of a button). I think it costs around $30.

  10. #10
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I have :

    XP SP3
    MS Access 2000.
    FE on desktop
    BE on Windows Server 2003
    BE mapped to S: drive. (folder on Server)


    If I take the FE/BE home, I have both files on C: drive (different folders). When I open the FE, it allows me to select the Drive/Folder/File to relink to.

    Attached is a zip of a FE. Put it on C drive and open it.
    You could link some tables to this FE, then move the BE and see if you still get the same file not found error.

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by Damonpc View Post
    In the scheme of things it is not a big issue, but i am just flumuxed as to how to catch the error when it executes so early. If i put a msgbox in the onload event of the start up form it will only run after i accept the original error message about the backend file not being available.

    Totally stumped.
    Link your tables in the Startup form rather than in the design *after* testing for the availability of the BackEnd. Here's a thread that might be useful: https://www.accessforums.net/program...-box-9512.html

Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to start
    By SlowPoke in forum Access
    Replies: 4
    Last Post: 09-16-2010, 07:41 AM
  2. Start Up Function in 07
    By cassidym in forum Database Design
    Replies: 3
    Last Post: 06-28-2010, 01:36 PM
  3. Start
    By LUGO in forum Access
    Replies: 1
    Last Post: 01-30-2010, 11:31 AM
  4. how can i start ?.
    By lavin80 in forum Access
    Replies: 1
    Last Post: 05-23-2009, 11:24 AM
  5. where do i start with this error message?
    By Student4Life in forum Access
    Replies: 0
    Last Post: 01-09-2009, 04:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums