I am trying to change all the entrys in a table that contain 0's to 1's when a user clicks a check box on a form. I am using the code below but it keeps erroring can anyone help?
Table is called tblChildren_Details and the Form is called frmBatch
Private Sub Check12_Click()
Dim rsttblChildren_Details As ADODB.Recordset
Dim conDatabase As ADODB.Connection
Dim strSQL As String
Set conDatabase = CurrentDb.Connection
strSQL = "Select * from tblChildren_Details where Batch = '" & 0 & "'"
Set rsttblChildren_Details = New Recordset
rsttblChildren_Details.Open strSQL, conDatabase, adOpenDynamic, adLockOptimistic
With rsttblChildren_Details
Do While Not .EOF
!Batch = 1
.Update
Loop
End With
rsttblChildren_Details.Close
conDatabase.Close
Set rsttblChildren_Details = Nothing
Set conDatabase = Nothing
End Sub
Thanks for any help
Table is called tblChildren_Details and the Form is called frmBatch
Private Sub Check12_Click()
Dim rsttblChildren_Details As ADODB.Recordset
Dim conDatabase As ADODB.Connection
Dim strSQL As String
Set conDatabase = CurrentDb.Connection
strSQL = "Select * from tblChildren_Details where Batch = '" & 0 & "'"
Set rsttblChildren_Details = New Recordset
rsttblChildren_Details.Open strSQL, conDatabase, adOpenDynamic, adLockOptimistic
With rsttblChildren_Details
Do While Not .EOF
!Batch = 1
.Update
Loop
End With
rsttblChildren_Details.Close
conDatabase.Close
Set rsttblChildren_Details = Nothing
Set conDatabase = Nothing
End Sub
Thanks for any help