I am trying to update a table using a recordset but I am having no luck.
There are 5 columns in the table that affect what I am trying to do.
They are: ConfCode, CC_B, CC_D, CC_ND, and CC_V. The first is
type Text and the others are Yes/No types. See the attached snippet
of the table.
For each record with a ConfCode of "D", I want the field CC_C to be
checked, i.e., True or Yes. Similarly with a ConfCode of "BVD", CC_B
to be checked, and so on.
The code runs without error, but the underlying table does not show
any check marks, even after clicking on "Refresh All".
Any assisttance appreciated.
Here is the code:
Dim myConnection As ADODB.Connection
Dim rst As New ADODB.Recordset
DoCmd.SetWarnings True
DoCmd.Echo True
Set myConnection = CurrentProject.Connection
rst.ActiveConnection = myConnection
rst.Open "SELECT * FROM [Individual Donor Table]"
'Check to see if the recordset actually contains rows
If Not (rst.EOF And rst.BOF) Then
rst.MoveFirst 'Unnecessary in this case, but still a good habit
Do Until rst.EOF = True
Select Case ConfCode
Case ConfCode = "D"
CC_D = True
Case ConfCode = "ND"
CC_ND = True
Case ConfCode = "BVD"
CC_B = True
Case ConfCode = "V"
CC_V = True
End Select
'Move to the next record. Don't ever forget to do this.
rst.MoveNext
Loop
Else
MsgBox "There are no records in the recordset."
End If
MsgBox "Finished looping through records."
rst.Close 'Close the recordset
Set rst = Nothing 'Clean up