I have records in my dsatabase in access, the table is called "Add Form". I have created a form in vb which i would like to Delete a selected record by the record from the table to show in the respective textboxes and then the user would click delete to delete the record and either click Next\Previous to navigate to another record. my code for the Next button:
If inc <> MaxRows - 1 Then
inc = MaxRows - 1
NavigateRecords()
ElseIf inc = -1 Then
MsgBox("This is the first record")
End If
the navigate function is here :
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
But its giving me this error:
Object reference not set to an instance of an object.
for the first line of the code under the navigate sub.
Please could you help me to program the button to go to the next record in the database.