New help with "check links"

M

Mattias

Hi

Have been running this code below before without having changed anything in
the code..anyway now I get error when running the code...

I get errormesseges in other codes as well and everytime it is something
about DAO

Appreciate any help here..what have happened.

Mattias

Compile error: Userdefined type not defined


Private Sub Form_Open(Cancel As Integer)
' Tests a linked table for valid back-end.
On Error GoTo Err_Form_Open
Dim strTest As String, db As DAO.Database
Dim td As DAO.TableDef
Set db = CurrentDb
For Each td In db.TableDefs
If Len(td.Connect) > 0 Then ' Is a linked table.
'DoCmd.OpenForm "HUVUDMEN"
On Error Resume Next ' Turn off error trap.
'DoCmd.OpenForm "HUVUDMEN"
strTest = Dir(Mid(td.Connect, 11)) ' Check file name.
On Error GoTo Err_Form_Open ' Turn on error trap.
If Len(strTest) = 0 Then ' No matching file.
If MsgBox("Kan inte hitta MbasMuseumServer " & _
Mid(td.Connect, 11) & ". Var vänlig välj korrekt databas
fil.", _
vbExclamation + vbOKCancel + vbDefaultButton1, _
"Kan inte hitta MbasMuseumServer filen.") = vbOK Then
DoCmd.OpenForm "frmNewDataFile" ' Open prompt form.
DoCmd.close acForm, Me.Name
Exit Sub ' to refresh links
Else
MsgBox "De länkade tabellerna kan inte hitta sin
datakälla. " & _
"Vänligen, logga in i nätverket igen och starta
MbasMuseum."
End If
End If
End If
Next ' Loop to next tabledef.
DoCmd.close acForm, Me.Name
DoCmd.OpenForm "HUVUDMEN"
Exit_Form_Open:
Exit Sub
Err_Form_Open:
MsgBox Err.Number & ": " & Error.Description
Resume Exit_Form_Open
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top