Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ErrorHandling

Empfohlene Antworten

Hallo,

ich hab folgendes Problem, ich hab eine Tabellenverlinkung von Access Datenbank zu einer anderen Access Datenbank automatisiert.

Jetz hab ich folgendes Problem, wenn ich eine Tabelle einbinden möchte, die aber in der Datenbank aus der ich suche nicht vorhanden ist, bekomme ich logischerweise eine Fehlermeldung, doch ich kann aus dieser fehlermeldung nur zurück in den debug modus, was ich nicht will, ich möchte, eine art error handling, bei der ich die fehlermeldungen vom system abfange, den fehlertext in eine messagebox gebe aus der ich anschließend das programm beenden kann.

Z.b.

Fehlermeldung: Tabelle "sowieso" konnte nicht in Datenbank 2 gefunden werden.

Laufzeitfehler : blalabla

_____________________

| |

| Programm abbrechen | <---- button

|____________________|

Kann mir jemand helfen?

Wenn es hilft hier mein code für die Tabellenverlinkung:

********************************************************

Option Compare Database

Option Explicit

Dim dbsCurrent As DAO.Database

Dim dbsForeign As DAO.Database

Dim rst As DAO.Recordset

Dim qdf As DAO.QueryDef

Dim tdf As DAO.TableDef

Dim str As String

Dim strtabn As String

Dim strPfad As String

Dim TableExists As Boolean

Private Sub Befehl9_Click()

' Datenbanken öffnen

Set dbsCurrent = CurrentDb

Set dbsForeign = OpenDatabase("DATABASEtwo.mdb")

Set qdf = dbsCurrent.QueryDefs("abfTabellen_Pfad")

Set rst = qdf.OpenRecordset

rst.MoveFirst

' Solange nicht End of File ist

Do While Not rst.EOF

Debug.Print "Tabellename: " & rst!TabName

Debug.Print "Pfad ="; rst!Pfad

strtabn = rst!TabName

strPfad = rst!Pfad

' Festlegen der Tabellenexistenz

For Each tdf In CurrentDb.TableDefs

If DCount("*", "MSysObjects", "Name='" & strtabn & "'") Then

TableExists = True

Else

TableExists = False

End If

' Abfrage ob Tabelle vorhanden, löschen-verlinken bzw. verlinken

If TableExists = True Then

DoCmd.DeleteObject acTable, strtabn

DoCmd.TransferDatabase acLink, "Microsoft Access", strPfad, acTable, strtabn, strtabn

Else

DoCmd.TransferDatabase acLink, "Microsoft Access", strPfad, acTable, strtabn, strtabn

End If

Next

' Nächster Datensatz

rst.MoveNext

Loop

End Sub

*****************************************************

thx mamuc

"On Error Goto" und "On Error Resume Next" sind deine freunde, wenn du VB6 und VBA programmierst.

mehr dazu ist z.b. hier zu finden:

Error Handling In VBA

s'Amstel

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.