M
Mark Kubicki
I have a continuous form with 2 controls for each record: a checkbox, and a
textbox
and have written, behind a command button on the form footer, the below code
to update all of the checkboxes to be true
however,
I am getting either of 2 errors
1 - if I have just clicked a checkbox (to false), all of the records
update to true except the record that just had the focus; on a second click,
it alos updates, and they are all true
2 - if I have just clicked a checkbox, then edited the textbox of that
record, I get a warning message that I have conflicting edits.... (only
editing the textbox, without clicking the checkbox does not seem to cause
this error)
I suspect that it's "something" to do with updating the record set, but at
am at a loss, and any suggestions would be much appreciated (thanks in
advance, mark)
Private Sub cmdPrintAll_Click()
Dim sSQL As String
sSQL = "update tblInstallationNotes" & _
" Set PrintInstallationNote = True;"
Dim Db As DAO.Database
Set Db = CurrentDb
Dim Rs As DAO.Recordset
Set Rs = Db.OpenRecordset("tblInstallationNotes", dbOpenDynaset)
Rs.Edit
Rs.Update
DoCmd.SetWarnings False
DoCmd.RunSQL sSQL
DoCmd.SetWarnings True
Me.Requery
End Sub
textbox
and have written, behind a command button on the form footer, the below code
to update all of the checkboxes to be true
however,
I am getting either of 2 errors
1 - if I have just clicked a checkbox (to false), all of the records
update to true except the record that just had the focus; on a second click,
it alos updates, and they are all true
2 - if I have just clicked a checkbox, then edited the textbox of that
record, I get a warning message that I have conflicting edits.... (only
editing the textbox, without clicking the checkbox does not seem to cause
this error)
I suspect that it's "something" to do with updating the record set, but at
am at a loss, and any suggestions would be much appreciated (thanks in
advance, mark)
Private Sub cmdPrintAll_Click()
Dim sSQL As String
sSQL = "update tblInstallationNotes" & _
" Set PrintInstallationNote = True;"
Dim Db As DAO.Database
Set Db = CurrentDb
Dim Rs As DAO.Recordset
Set Rs = Db.OpenRecordset("tblInstallationNotes", dbOpenDynaset)
Rs.Edit
Rs.Update
DoCmd.SetWarnings False
DoCmd.RunSQL sSQL
DoCmd.SetWarnings True
Me.Requery
End Sub