Hi,
I have from which a user clicks on a button to add a new record.
When a user clicks on that button a new form opens with empty fields. Now for adding a new record I am using ADO.
Everything works OK when I have at least one record in a table.
I have a problem when the table is empty.
Problem:
A new record is added and a user clicks on a back button to go to a previous form. When that button is clicked another record is added to the table with a previous ID.
For example
I am adding a new record with an ID 18 when the back button is clicked another record is added for ID 17.
A record for ID 17 was deleted when I cleaned the table.
Add New
rs.AddNew
rs.Fields("Start Date") = txtStartDate.Value
rs.Fields("Close Date") = txtCloseDate.Value
rs.Fields("Year") = txtYear.Value
rs.Fields("Article") = cmbArticle
rs.Fields("Miscillaneous") = txtMiscillaneous.Value
rs.Fields("Memo") = txtMemo.Value
rs.Fields("Resolution") = cmbResolution.Value
rs.Update
rs.Close
cmdBack
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "View"
Maria
I have from which a user clicks on a button to add a new record.
When a user clicks on that button a new form opens with empty fields. Now for adding a new record I am using ADO.
Everything works OK when I have at least one record in a table.
I have a problem when the table is empty.
Problem:
A new record is added and a user clicks on a back button to go to a previous form. When that button is clicked another record is added to the table with a previous ID.
For example
I am adding a new record with an ID 18 when the back button is clicked another record is added for ID 17.
A record for ID 17 was deleted when I cleaned the table.
Add New
rs.AddNew
rs.Fields("Start Date") = txtStartDate.Value
rs.Fields("Close Date") = txtCloseDate.Value
rs.Fields("Year") = txtYear.Value
rs.Fields("Article") = cmbArticle
rs.Fields("Miscillaneous") = txtMiscillaneous.Value
rs.Fields("Memo") = txtMemo.Value
rs.Fields("Resolution") = cmbResolution.Value
rs.Update
rs.Close
cmdBack
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "View"
Maria