I'm trying to figure out/learn how to overwrite previously saved data. Right now when I save data to my excel form and then reopen it, to edit, a duplicate row with the edited data is shown along with the previously saved data as well.
The duplicate rows are being inserted and not being appended. One of the tabs used, I was able to clearform() since it is only one row of data, but the other tabs have multiple rows from the excel sheet, which I scroll through with buttons so I am unable to just clear the form.
If PERSON_EXCEL_DATA.Rows.Count > 0 Then
For Each CURRENTROW As DataRow In PERSON_EXCEL_DATA.Rows
Me.EVENT_ASSOC1.Text = PFC_Xpress.Tables("PERSON").Rows(0).Item("Event Association").ToString
Me.Name1.Text = PFC_Xpress.Tables("PERSON").Rows(0).Item("NAME").ToString
'Here is what I have for the tab which I am able to just 'clear
If EVENT_INFO_EXCEL_DATA.Rows.Count > 0 Then
For Each CURRENTROW As DataRow In EVENT_INFO_EXCEL_DATA.Rows
Me.EVENT_NUMBER.Text = CURRENTROW.Item("EVENT NUMBER").ToString
I am reopening a saved excel spreadsheet datatable back into my windows form. After doing so, I will edit or add more data in the windows form, save it (under same filename), but when I open the actual excel spreadsheet there are duplicate entries. For example, the first row is the information from when I saved the excel file the first time and the second row is all of the information from the first time entering data plus the updated information I entered the second time. I am trying to figure out how I can overwrite/delete the first row of old information so there is no duplicate. I used 'clearform' for part of the datatable in my program because there is only one row of data there, but the problem I am running into is the other parts where there is more than one row in the datatable and since my windows form only displays one row at a time, I can't just use 'clearform'
Thank you for the post guys. The example worked great Jim. I'm new to all of this and I know I should have started smaller, but figured there's no quicker way to learn than throwing myself into the mix of it all.