【Access + SQL + VBA】更新查询同一字段多条件更新

Dim strSQL As String
strSQL = "Update tbl_发票收发 " & _
“SET 发票内容 = switch” & _
“(发票内容 Like ‘物业’, ‘管理费租金’ ,” & _
“发票内容 Like ‘物管’, ‘管理费租金’ ,” & _
“发票内容 Like ‘管理费’, ‘管理费租金’ ,” & _
“发票内容 Like ‘租金’, ‘管理费租金’ ,” & _
“发票内容 Like ‘水果’, ‘下午茶’ ,” & _
“发票内容 Like ‘农夫山泉’, ‘饮品’ ,” & _
“发票内容 Like ‘软饮料’, ‘饮品’ ,” & _
“发票内容 Like ‘顺丰’, ‘快递’ ,” & _
“发票内容 Like ‘电信服务’, ‘电信服务’ ,” & _
“发票内容 Like ‘的士’, ‘计程车’ ,” & _
“发票内容 Like ‘出租车’, ‘计程车’ ,” & _
“发票内容 Like ‘机场’, ‘机票’ ,” & _
“发票内容 Like ‘检测’, ‘检测’ ,” & _
“true, 发票内容)” '此段十分紧要,若果没有就会其他没有定义的都全部当null

DoCmd.RunSQL strSQL

你可能感兴趣的:(access,VBA,access,vba,sql)