Suppress Linked Table Missing Errror and Replace it with custom error message

AmyLambes

New member
Local time
Yesterday, 20:12
Joined
Mar 25, 2012
Messages
4
I have created just a simple user interface that when the database is opened it goes and checks if a security table is there and what date is in the table, if it is not up to date it says CANNOT USE, UPDATE TABLES. This lets me make sure all locations have been updated during the night and it prevents people from copying the program to another computer, because it is a hidden table.
What happens is if they copy it to another computer and try to run it, the program says "could not find file C:\.......
What I would like to happen is to be able to suppress this error and have it say "Call support for help with the program" or what ever I like to put there. I don't want the system error to come up.
Is this possible?
If not is there a way if a table is moved or copied that the contents are deleted or set to a specific value. It is a table with only one record and one field.
Thank You for any assistance
 
Have you tried trapping the error, something like this (untested)?

Code:
Private Sub Form_Load()
On Error GoTo Err_Handler
 
     'Some code...
 
Err_Handler:
     If Err.Number = 3024 Then
          MsgBox "Call support for help with the program.", vbOkOnly
          DoCmd.Quit
     End If
 
Have you tried trapping the error, something like this (untested)?

Code:
Private Sub Form_Load()
On Error GoTo Err_Handler
 
     'Some code...
 
Err_Handler:
     If Err.Number = 3024 Then
          MsgBox "Call support for help with the program.", vbOkOnly
          DoCmd.Quit
     End If

does not bypass the system error.
 
I tested with a DLookup on a table and it did trap the error, but the error generated may vary based on the function you're calling. What is the error number generated on your end? Try replacing "3024" with the error number Access is returning.

Code:
Private Sub Form_Load()
On Error GoTo Err_Handler
 
    MsgBox DLookup("txtCustomerAbbrev", "Customers", "lngCustomerID_pk=1")
 
Exit_Handler:
    Exit Sub
Err_Handler:
    If Err.Number = 3024 Then
        MsgBox "Call support for help with the program.", vbOKOnly
        DoCmd.Quit
     End If
    Call LogError(Err.Number, Err.Description, "frmSplash.Form_Load()")
    Resume Exit_Handler
End Sub
 
I tested with a DLookup on a table and it did trap the error, but the error generated may vary based on the function you're calling. What is the error number generated on your end? Try replacing "3024" with the error number Access is returning.

Code:
Private Sub Form_Load()
On Error GoTo Err_Handler
 
    MsgBox DLookup("txtCustomerAbbrev", "Customers", "lngCustomerID_pk=1")
 
Exit_Handler:
    Exit Sub
Err_Handler:
    If Err.Number = 3024 Then
        MsgBox "Call support for help with the program.", vbOKOnly
        DoCmd.Quit
     End If
    Call LogError(Err.Number, Err.Description, "frmSplash.Form_Load()")
    Resume Exit_Handler
End Sub
Oh Duh!! Sorry I have had a long day!! Got it!!! Thanks so much for your time!!!
 

Users who are viewing this thread

Back
Top Bottom