I'm using .AddNew to add 3 new records to my table (which it does perfectly). After I add these 3 records, I want to run an update on one field using DoCmd.RunSQL. When I run this though, I get '0 records updated'. It will not allow me to update these records right after I've added them. I'm using ADO vs. DAO so everything I've read has told me I should be able to work with the newly added record right away. What am I doing wrong? I've included my code below. Thanks in advance!
rst.Open "[tbl_RIF-App Info]", cnn, adOpenKeyset, adLockOptimistic
With rst
FirstApp = "Yes"
.AddNew
![DM #] = DM
![Estimate_Type] = "Sizing"
.AddNew
![DM #] = DM
![Estimate_Type] = "Planning"
.AddNew
![DM #] = DM
![Estimate_Type] = "Commit"
If ((Application = "BDS-ST") Or _
(doc.FormFields("DropDown7").Result = "BDS-ST") Or _
(doc.FormFields("RBITApp1").Result = "BDS-ST") Or _
(doc.FormFields("RBITApp2").Result = "BDS-ST") Or _
(doc.FormFields("RBITApp3").Result = "BDS-ST")) Then
![BDS-ST] = 0
DoCmd.RunSQL "UPDATE [tbl_RIF-App Info] SET [BDS-ST] = 0 WHERE [DM #]=" & DM
Else: ![BDS-ST] = Null
End If
.Update
.Close
End With
rst.Open "[tbl_RIF-App Info]", cnn, adOpenKeyset, adLockOptimistic
With rst
FirstApp = "Yes"
.AddNew
![DM #] = DM
![Estimate_Type] = "Sizing"
.AddNew
![DM #] = DM
![Estimate_Type] = "Planning"
.AddNew
![DM #] = DM
![Estimate_Type] = "Commit"
If ((Application = "BDS-ST") Or _
(doc.FormFields("DropDown7").Result = "BDS-ST") Or _
(doc.FormFields("RBITApp1").Result = "BDS-ST") Or _
(doc.FormFields("RBITApp2").Result = "BDS-ST") Or _
(doc.FormFields("RBITApp3").Result = "BDS-ST")) Then
![BDS-ST] = 0
DoCmd.RunSQL "UPDATE [tbl_RIF-App Info] SET [BDS-ST] = 0 WHERE [DM #]=" & DM
Else: ![BDS-ST] = Null
End If
.Update
.Close
End With