Question : ms access update  query

Hi I have to update a checkbox field in a table based on a query. and there are two conditions to it  as well.  I am getting an error  " Operations must use an updatable query "

I am pasting my query

UPDATE tbl_survey INNER JOIN Query2 ON tbl_survey.ID = Query2.ID SET tbl_survey.service = Yes
WHERE (((Query2.part_rate)="52") AND ((tbl_survey.survey_year)="2010"));

Answer : ms access update  query

The code below is "air code" (not tested). I still think it would be better to use a query based on your actual tables instead of Query2, but in the end you need a solution that you can maintain, so it's your call.

(°v°)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
    Dim strSQL As String
    Dim varID
    
    strSQL = "SELECT * FROM tbl_survey WHERE survey_year='2010'"
    With CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
        Do Until .EOF
            varID = DLookup("ID","Query2","part_rate='52' and ID=" & !ID)
            If Not IsNull(varID) Then
                .Edit
                !service = True
                .Update
            End If
            .MoveNext
        Loop
        .Close
    End With
Random Solutions  
 
programming4us programming4us