I am using the foilowing statements to add a new record to an access table:
Set rs3 = db.OpenRecordset("ADJ")
rs3.MoveLast
rs3.MoveNext
rs3.AddNew
rs3![CTLNO] = wCTLNO
rs3![ADJAMT] = formadj
rs3![ADJDATE] = wadjdate
rs3![GRANTNAME] = wgname
rs3![USERID] = wuserid
rs3.Update
rs3.Close
I also used this statement but got the same results:
db.Execute "Insert into ADJ (CTLNO, ADJAMT, ADJDATE, GRANTNAME, USERID) values ('" & wCTLNO & "', '" & formadj & "', '" & wadjdate & "', '" & wgname & "', '" & wuserid & "')"
Problem is that it is adding two of the same records. It is adding a new one to the end of the table like it should but it is also overwriting the first record in the table. I can't figure out why it does this. I don't want the first record overwritten, just want one new record.
I am also getting a WRITE CONFLICT error when I close the form that runs this code. I am the only one using this application. Any ideas why would really help.
Please help!
Set rs3 = db.OpenRecordset("ADJ")
rs3.MoveLast
rs3.MoveNext
rs3.AddNew
rs3![CTLNO] = wCTLNO
rs3![ADJAMT] = formadj
rs3![ADJDATE] = wadjdate
rs3![GRANTNAME] = wgname
rs3![USERID] = wuserid
rs3.Update
rs3.Close
I also used this statement but got the same results:
db.Execute "Insert into ADJ (CTLNO, ADJAMT, ADJDATE, GRANTNAME, USERID) values ('" & wCTLNO & "', '" & formadj & "', '" & wadjdate & "', '" & wgname & "', '" & wuserid & "')"
Problem is that it is adding two of the same records. It is adding a new one to the end of the table like it should but it is also overwriting the first record in the table. I can't figure out why it does this. I don't want the first record overwritten, just want one new record.
I am also getting a WRITE CONFLICT error when I close the form that runs this code. I am the only one using this application. Any ideas why would really help.
Please help!