アクセス中のデータベースにレコードがあり、テーブルは「フォームの追加」と呼ばれます。選択したレコードをテーブルからレコードごとに削除して、それぞれのテキスト ボックスに表示する vb でフォームを作成しました。ユーザーは [削除] をクリックしてレコードを削除し、[次へ] または [前へ] をクリックして別のレコードに移動します。 . 次へボタンの私のコード:
If inc <> MaxRows - 1 Then
inc = MaxRows - 1
NavigateRecords()
ElseIf inc = -1 Then
MsgBox("This is the first record")
End If
ナビゲート機能はここにあります:
Private Sub NavigateRecords()
Student_IDTextBox.Text = ds.Tables("Add Form").Rows(inc).Item(0)
Student_NameTextBox.Text = ds.Tables("Add Form").Rows(inc).Item(1)
Date_of_BirthDateTimePicker.Text = ds.Tables("Add Form").Rows(inc).Item(2)
AddressTextBox.Text = ds.Tables("Add Form").Rows(inc).Item(3)
E_mailTextBox.Text = ds.Tables("Add Form").Rows(inc).Item(4)
AllergiesTextBox.Text = ds.Tables("Add Form").Rows(inc).Item(5)
Emergency_Contact_NumberTextBox.Text = ds.Tables("Add Form").Rows(inc).Item(6)
End Sub
しかし、それは私にこのエラーを与えます:
Object reference not set to an instance of an object.
ナビゲートサブの下のコードの最初の行。
データベース内の次のレコードに移動するボタンをプログラムするのを手伝ってくれませんか。