Recordsetclone循环
问题描述:
下面的代码工作,但只有第一个记录在连续的形式不循环扔记录。因此,如果第一条记录被选中,那么我会收到消息“在继续之前,您需要选择一个RELEASE复选框。”如果它不是,我会收到其他消息。Recordsetclone循环
我需要做的是运行所有复选框,它们是“ReleaseProduct”,并在它到达的第一个复选框中出现,如果有复选框并且给出消息并且如果没有选中复选框运行取消= fncRequiredReleaseSelectedEmail(我)并退出子。林搞乱了环某处......
这里是我在我的表格按钮的代码....
Dim Cancel As Integer
Dim rs As Recordset
Set rs = Me.frmsub_ProductHoldData.Form.RecordsetClone
With rs
.MoveFirst
Do While Not .EOF
If rs.Fields("ReleaseProduct") = False Then
MsgBox "You need to select a RELEASE check box before proceeding.", vbInformation, "Selection Error"
Exit Sub
Else
Cancel = fncRequiredReleaseSelectedEmail(Me)
Exit Sub
End If
.MoveNext
Loop
End With
答
我有一个很难讲,如果这是你在寻找什么不是,但是这会查看所有这些记录,并且只有在被检查时才采取行动。
仅当选中“释放”复选框时,才会显示未选中复选框的警告。
Dim Cancel As Integer
Dim rs As Recordset
Set rs = Me.frmsub_ProductHoldData.Form.RecordsetClone
With rs
.MoveFirst
Do While Not .EOF
If rs.Fields("ReleaseProduct") = True Then
Cancel = fncRequiredReleaseSelectedEmail(Me)
Exit Sub
End If
.MoveNext
Loop
MsgBox "You need to select a RELEASE check box before proceeding.", vbInformation, "Selection Error"
End With
在'If'条件下你有'Exit Sub'。它永远不会超过一次传球。 – RLH