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.

Fehler beim schreiben in eine Combobox

Empfohlene Antworten

Veröffentlicht

Hallo Leute,

wenn ich in meine Combobox werte hinein schreiben will bring er den Lafzeitfehler 94 und zwar genau an der stelle


Option Explicit


Private Sub Form_Load()

Dim rs As New ADODB.Recordset

Dim rs2 As New ADODB.Recordset

Dim cn As New ADODB.Connection

Dim File As String

Dim col As String

Dim col2 As String

Dim SQL As String

Dim SQL2 As String


    File = "C:\Abschluss-Projekt\Rechnung\KontenD2.mdb"

    col = "FernmKtoNr"

    col2 = "BuchungsNr"

    SQL = "SELECT " & col & " FROM FernmktoNr"

    SQL2 = "SELECT " & col2 & " FROM FernmktoNr"

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & File, "", "", -1

rs.Open SQL, cn, adOpenStatic, adLockPessimistic, -1

rs2.Open SQL2, cn, adOpenStatic, adLockPessimistic, -1

Do While Not rs.EOF

    cmbsuchFernmeld.AddItem (rs.Fields("FernmKtoNr"))

    'txtBehoerdenkuerzel.Text = rs.Fields("Behördenkürzel")

    rs.MoveNext

Loop


Do While Not rs2.EOF


    cmbSuchBuchNr.AddItem (rs2.Fields("BuchungsNr")) 'Genau hier kommr der Fehler

    rs2.MoveNext


Loop


rs2.Close

rs.Close

cn.Close

Set rs2 = Nothing

Set rs = Nothing

Set cn = Nothing

End Sub

kann mir jemand helfen?? Danke schonmal im Voraus...!!!

Also das feld gibt es zu 10000....%

es ist auch richtig das nicht in allen feldern was drin steht!

gibt es da noch ein anderes objekt als AddItem was ich nehmen kann?

könntest du mir mal auf die sprünge helfen hab den kopf grad ganz schön voll und sehe keinen ansatz wie ich es machen könnte...!!!!

[klugschei_ß]

Performant ungünstig 2 mal die Datenbank aufzumachen, nur weil du verschiedene Spalten willst. (Die auch noch in der gleichen Tabelle stehen.)

Selectier im rs doch einfach gleich beide Spalten.

[/klugschei_ß]

könntest du mir mal auf die sprünge helfen hab den kopf grad ganz schön voll und sehe keinen ansatz wie ich es machen könnte...!!!!


Dim item as object = rs2.Fields("BuchungsNr")

if item isnot Nothing then cmbSuchBuchNr.AddItem(item) 

Danke dir!!! jetzt funktioniert es!!!!!:D

Hübsch machen fetzt.


File = "C:\Abschluss-Projekt\Rechnung\KontenD2.mdb"

col = "FernmKtoNr"

col2 = "BuchungsNr"

SQL = "SELECT " & col & ", " & col2 & " FROM FernmktoNr"

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & File, "", "", -1

rs.Open SQL, cn, adOpenStatic, adLockPessimistic, -1

Dim item as object

Do While Not rs.EOF

[INDENT]item = rs.Fields(col)

if item isnot Nothing then cmbsuchFernmeld.AddItem (item)

item = rs2.Fields(col2)

if item isnot Nothing then cmbSuchBuchNr.AddItem(item)[/INDENT]


rs.MoveNext

Loop

:floet:

if item isnot Nothing then cmbSuchBuchNr.AddItem(item)

dieses Stück funktioniert bei mir doch nicht so ganz...da sagt er wo das isnot

steht er erwartet eon Then oder GoTo!

was kann ich da tun??

Probiers mal mit Zeilenumbruch.


if item isnot Nothing then 

[INDENT]cmbSuchBuchNr.AddItem(item)[/INDENT]


end if

oder einfach:

if NOT item is Nothing then 

[INDENT]cmbSuchBuchNr.AddItem(item)[/INDENT]


end if

Hi.

VB6 kennt kein IsNot. Stattdessen: If Not item Is Nothing Then oder If Not item = Nothing Then. Musst mal probieren. :)

mfg Thomas

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.