用recordset解决。 me.recordset用来提取当前窗体的记录集
sub setall()
dim rs as dao.recordset
set rs = me.recordset
with rs
.movefirst
do until .eof
refreshstatus .fieds("STATE").value
.movenext
loop
end with
set rs=nothing
end sub
Private Sub refreshstatus(intState as integer)
Select Case intState
Case 0
ImgA01.Picture = "running"
Case 1 To 2
ImgA01.Picture = "standby"
Case 3 To 4
ImgA01.Picture = "stop"
Case 5 To 10
ImgA01.Picture = "fault"
End Select
End Sub