Hey guys how you doing,

When i try to add a record through my application i get an error message there is no row at position 0
here is the code any help would be appericiated:

       Dim con As New OleDb.OleDbConnection
        Dim dbprovider As String
        Dim dbsource As String
        Dim sqlquery As String
        dbprovider = " PROVIDER= Microsoft.Ace.OLEDB.12.0;"
        dbsource = "Data Source = \\athena\StudentHomes\09000298\Documents\Cg2_Coursework.accdb"
        sqlquery = "SELECT* FROM Customer"
        con.ConnectionString = dbprovider & dbsource
        con.Open()
        MsgBox("Database is now open")

        Dim da2 As OleDb.OleDbDataAdapter


        da2 = New OleDb.OleDbDataAdapter(sqlquery, con)
        da2.Fill(ds, "Customer")
    With ds.Tables("Customer").Rows.Add("Customer")
        txt_Firstname.Text = .Item("Customer_Firstname")
        txt_Secondname.Text = .Item("Customer_Secondname")
        txt_Country.Text = .Item("Customer_Address1")
        txt_Town.Text = .Item("Customer_Address2")
        txt_Street.Text = .Item("Customer_Address3")
        txt_Postcode.Text = .Item("Customer_Postcode")
        txt_Number.Text = .Item("Customer_Contact_Number")
        txt_Email.Text = .Item("Customer_Email")
    End With


        MsgBox("New Record added to the Database")

HI,
If you are trying to add record where are you inserting your data?

there is no insert sql there in ur code

Hi, in an Access Database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.