我将鼠标光标放在“记录选择区域”上。
我突出显示几个条目。
情况1-ок。
我从上到下选择(4,5,6)。
结果:复选框已正确填充-4、5、6。
情况2-问题。
我进行选择向下(6、5、4)。
结果:复选框以6、7、8镜像填充。
复选框以镜像方式填充。
问题。
无论选择记录的方向如何,如何使复选框正确填充?
答案 0 :(得分:1)
您可以使用 RecordsetClone 这样的方式进行操作:
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim Records As DAO.Recordset
Dim Height As Long
Dim Top As Long
Dim Offset As Long
Dim Count As Long
Height = Me.SelHeight
If Height > 1 Then
Top = Me.SelTop
Me.SelHeight = 0
If Me.CurrentRecord > Top Then
Offset = Height - 1
End If
Set Records = Me.RecordsetClone
Records.MoveFirst
Records.Move -Offset, Me.Bookmark
For Count = 0 To Height - 1
Records.Edit
Records!PurchaseArea.Value = True
Records.Update
Records.MoveNext
Next
Records.Close
End If
End Sub