Ich versuche etwas mit VBA in Access, aber ich kann nicht sehen, was ich falsch mache.Zugriff: Erstellen Sie n Datensätze mit Recordset
Ich habe in einem Formular eine Textkontrolle (numerisch), wo ich eine Nummer schreiben kann. Was ich will ist, wenn ich auf eine Schaltfläche im Formular klicke, so viele Datensätze in einer anderen Tabelle (nicht die Quelle des Formulars) als die Zahl in der Textsteuerung erstellen.
Ich versuche dies, aber es tut nichts:
Dim db As Database
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("Table")
If Not rst.EOF And rst.BOF Then
Do While rst.RecordCount < Me.Txt_Control
rst.Edit
rst.Fields("Field_01") = "Example 1"
rst.Fields("Field_02") = "Example 2"
rst.Fields("Field_03") = "Example 3"
rst.Update
rst.MoveNext
Loop
rst.Close
End If
Kann mir jemand eine Hand geben?
Grüße.