Hauptmenü
MS-Access
Lösung:
Public Function ExtDLookUp _ (strDB As String, _ strFeld As String, _ strTabelle As String, _ strBedingung As String _ ) On Error GoTo ErrorHandle Dim db As Database Dim rs As Recordset Set db = DBEngine.OpenDatabase(strDB) Set rs = db.OpenRecordset( _ "SELECT " & strFeld & " " & _ "FROM " & strTabelle & " " & _ "WHERE " & strBedingung & ";") If Not rs.EOF Then ExtDLookUp = rs(0) End If Set rs = Nothing Set db = Nothing Exit Function ErrorHandle: ExtDLookUp = "Error" End Function |