Hey,
Thats the code im using for my starup form, to check if linked tables have a connection:
Thats the responce i get in Immediate window:
Does anyone have an idea why for some reason this code does not work? And the strangest think is that at the start i get debuge.print with the link that should work and with the second debug.print i get some old link(the link where i write/test my DB).
Thats the code im using for my starup form, to check if linked tables have a connection:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim LinkSt, errSt
On Error GoTo err_Handler
Debug.Print "[Start Link]" & CurrentDb.TableDefs("tblArhivARM").Connect
LinkSt = DLookup("Nazv", "tblArhvOpir")
LinkSt = DLookup("Nazv", "tblArhvARiM")
LinkSt = DLookup("Nazv", "tblArhvMRiK")
'DoCmd.OpenForm "frmMain"
'DoCmd.Close acForm, "frmCheckLinkTablesLinks", acSaveYes
Text0 = Mid(CurrentDb.TableDefs("tblArhvARiM").Connect, 11)
err_Exit:
Exit Sub
err_NoTable:
If Not errSt = Null Or Not errSt = "" Then
tblSt = Split(errSt, "'")
Me.LOzorilo.Caption = "Table '" & tblSt(1) & "' does not exist!"
End If
Debug.Print "[No Table]" & errSt
Exit Sub
err_NoFile:
Me.LOzorilo.Caption = "File does not exist!"
Debug.Print "[No File]" & errSt
Exit Sub
err_Handler:
If Err.Number = 3078 Then
errSt = Err.Description
Resume err_NoTable
End If
If Err.Number = 3024 Then
errSt = Err.Description
Resume err_NoFile
End If
MsgBox Err.Number & " - " & Err.Description
Resume err_Exit
End Sub
Thats the responce i get in Immediate window:
Code:
[Start Link];DATABASE=P:\H12\I&C\ECIA.mdb
[No File]Could not find file 'C:\Documents and Settings\SH\My Documents\EIiC\ECIA.mdb'.
Does anyone have an idea why for some reason this code does not work? And the strangest think is that at the start i get debuge.print with the link that should work and with the second debug.print i get some old link(the link where i write/test my DB).