Broken Links - Missing some lines 
Author Message
 Broken Links - Missing some lines

Hi to all,

Before my database starts I check the references for broken links simply to
check
if the referencedatabases are in the same directory as the frontEndDatabase.

In the lines below I have only mention 2 referencedatabases, but actully I
have 9 of them.

The referencedatabases are and shall allways be in the same directory as the
FrontEndDatabase.

My problem is that when I install the database for the first time on a "new"
computer
it seems to that the function "ActualDbPath" will not work.

Therefor are the anybody who can show me how to check if there are some
broken links and which
referencedatabases there cause this broken links in a messagebox and there
after
shut down the database.

Any help will be greatfull.

Thanks in advance.

Mik

'*********************Function start*************************************

Function ActualDbPath()

  Dim db As Database
  Dim strPath As String

  Set db = DBEngine.Workspaces(0).Databases(0)
  strPath = db.Name

  While (right(strPath, 1) <> "\") And (Len(strPath) > 1)
    strPath = left(strPath, Len(strPath) - 1)
  Wend

  Set db = Nothing

  ActualDbPath = strPath

End Function

'*********************Function start*************************************

Function TestReference()

'Dim ActualDbPath As String
'ActualDbPath = Application.GetOption("Default Database Directory")

'Application.SetOption ("Default Database Directory"), ActualDbPath
'Does not work on the first installation.
'because I do not now in which directory the user install the database.

If fIsFileDIR("" & ActualDbPath & "tbslan32.mda") = True And _
   fIsFileDIR("" & ActualDbPath & "tbsmas32.mda") = True Then

    StartUser ' If everything is OK continue loading program
Else
    TestReferenceError ' If there is some errors show a messagesbox whit the
Errorlink
End If

End Function

'*********************Function start*************************************

Function fIsFileDIR(stPath As String, Optional lngType As Long) As Integer
'Fully qualify stPath'To check for a file'   ?fIsFileDIR("c:\winnt\win.ini")
'To check for a Dir'   ?fIsFileDir("c:\msoffice",vbdirectory)'
    On Error Resume Next
    fIsFileDIR = Len(Dir(stPath, lngType))

    If fIsFileDIR <> 0 Then
        fIsFileDIR = True
    Else
        fIsFileDIR = False
    End If

End Function

'*********************Function start*************************************

Function TestReferenceError()

Dim ActualDbPath As String
ActualDbPath = Application.GetOption("Default Database Directory")

Dim tbslan32 As String
Dim tbsmas32 As String

If fIsFileDIR("" & ActualDbPath & "tbslan32.mda") = False Then tbslan32 =
"Error Link"
If fIsFileDIR("" & ActualDbPath & "tbsmas32.mda") = False Then tbsmas32 =
"Error Link"

MsgBox "tbslan32:     " & tbslan32 _
& vbcrlf & "tbsmas32:     " & tbsmas32 _
& vbcrlf & vbcrlf _
& "Write down the line(s) with ""Error Link""" _
& vbcrlf & "and call the dealer." & Errlog, vbCritical, "TotalBase -
Errorlink"

Application.Quit acPrompt

End Function



Fri, 02 Feb 2001 03:00:00 GMT  
 Broken Links - Missing some lines
To check the references you have to use the references object!
I made some code to check the references some time ago but
will have to find it first befor being able to post it to you.

However, as far as I know this is USELESS, because Access
will not even allow you to check the references if they are broken.
As far as I remember it will stop with a message like:
"Project or Library not found" even if checking (and resetting) the
references is the first thing you attempt to do.

I would be glad to be shown that I'm wrong.

--
Bernhard Aggeler
Consultant



Fri, 02 Feb 2001 03:00:00 GMT  
 Broken Links - Missing some lines
If you are using code in a situation where you suspect you may have broken
references you should always fully qualify functions.

Your Function ActualDbPath() I would code like this

Function ActualDbPath()
  Dim strPath As String
  strpath = Access.Currentdb.Name
  strPath = VBA.Left(strPath, VBA.Instr(strPath, VBA.DIR(strPath))-1)
  ActualDbPath = strPath
End Function

Quote:

>Hi to all,

>Before my database starts I check the references for broken links simply to
>check
>if the referencedatabases are in the same directory as the
frontEndDatabase.

>In the lines below I have only mention 2 referencedatabases, but actully I
>have 9 of them.

>The referencedatabases are and shall allways be in the same directory as
the
>FrontEndDatabase.

>My problem is that when I install the database for the first time on a
"new"
>computer
>it seems to that the function "ActualDbPath" will not work.

>Therefor are the anybody who can show me how to check if there are some
>broken links and which
>referencedatabases there cause this broken links in a messagebox and there
>after
>shut down the database.

>Any help will be greatfull.

>Thanks in advance.

>Mik

>'*********************Function start*************************************

>Function ActualDbPath()

>  Dim db As Database
>  Dim strPath As String

>  Set db = DBEngine.Workspaces(0).Databases(0)
>  strPath = db.Name

>  While (right(strPath, 1) <> "\") And (Len(strPath) > 1)
>    strPath = left(strPath, Len(strPath) - 1)
>  Wend

>  Set db = Nothing

>  ActualDbPath = strPath

>End Function

>'*********************Function start*************************************

>Function TestReference()

>'Dim ActualDbPath As String
>'ActualDbPath = Application.GetOption("Default Database Directory")

>'Application.SetOption ("Default Database Directory"), ActualDbPath
>'Does not work on the first installation.
>'because I do not now in which directory the user install the database.

>If fIsFileDIR("" & ActualDbPath & "tbslan32.mda") = True And _
>   fIsFileDIR("" & ActualDbPath & "tbsmas32.mda") = True Then

>    StartUser ' If everything is OK continue loading program
>Else
>    TestReferenceError ' If there is some errors show a messagesbox whit
the
>Errorlink
>End If

>End Function

>'*********************Function start*************************************

>Function fIsFileDIR(stPath As String, Optional lngType As Long) As Integer
>'Fully qualify stPath'To check for a file'

?fIsFileDIR("c:\winnt\win.ini")

- Show quoted text -

Quote:
>'To check for a Dir'   ?fIsFileDir("c:\msoffice",vbdirectory)'
>    On Error Resume Next
>    fIsFileDIR = Len(Dir(stPath, lngType))

>    If fIsFileDIR <> 0 Then
>        fIsFileDIR = True
>    Else
>        fIsFileDIR = False
>    End If

>End Function

>'*********************Function start*************************************

>Function TestReferenceError()

>Dim ActualDbPath As String
>ActualDbPath = Application.GetOption("Default Database Directory")

>Dim tbslan32 As String
>Dim tbsmas32 As String

>If fIsFileDIR("" & ActualDbPath & "tbslan32.mda") = False Then tbslan32 =
>"Error Link"
>If fIsFileDIR("" & ActualDbPath & "tbsmas32.mda") = False Then tbsmas32 =
>"Error Link"

>MsgBox "tbslan32:     " & tbslan32 _
>& vbcrlf & "tbsmas32:     " & tbsmas32 _
>& vbcrlf & vbcrlf _
>& "Write down the line(s) with ""Error Link""" _
>& vbcrlf & "and call the dealer." & Errlog, vbCritical, "TotalBase -
>Errorlink"

>Application.Quit acPrompt

>End Function



Fri, 02 Feb 2001 03:00:00 GMT  
 Broken Links - Missing some lines
Hi Bernhard,
If you're links checking code is the first thing to be run and you use
explicit references (e.g. VBA.Left, not just left) then it will work.
Quote:

>To check the references you have to use the references object!
>I made some code to check the references some time ago but
>will have to find it first befor being able to post it to you.

>However, as far as I know this is USELESS, because Access
>will not even allow you to check the references if they are broken.
>As far as I remember it will stop with a message like:
>"Project or Library not found" even if checking (and resetting) the
>references is the first thing you attempt to do.

>I would be glad to be shown that I'm wrong.

>--
>Bernhard Aggeler
>Consultant



Fri, 02 Feb 2001 03:00:00 GMT  
 Broken Links - Missing some lines
Thank you Terry you are a champion


Fri, 02 Feb 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Line Break vs. Paragraph Break

2. Break Links or Paste without Links from QuatroPro

3. Access 97 Broken Links and Speed Problems

4. breaking links to excel programmatically

5. Breaking all Links of a Ressourcepool

6. Breaking Links in VBA code

7. Toggle footer - break the link

8. Automating Breaking Links in Word

9. programmatically breaking links to excel

10. Break Links - A ? for a MVP

11. VB Broken Links Checker

12. DirectX 8 vb docs - broken link?

 

 
Powered by phpBB® Forum Software