我有一个按钮的代码,它设置了一个名为 ProjectCompleteOrgBtn 的布尔值。
我试图让这个按钮在你点击它时将布尔值设置为真,然后如果你在它变为假后再次单击它,然后再次为真,重复。
true 和 false 对下面的表格进行不同的排序。尽管目前每次单击按钮时,它始终是正确的。我该如何解决?
Private Sub ProjectCompleteOrgBtn_Click()
Dim ProjectCompeleteOrgB As Boolean
If ProjectCompleteOrgB = True Then
Set ProjectCompleteOrgB = False
Else
Set ProjectCompleteOrgB = True
If ProjectCompleteOrgB = False Then
MsgBox (False)
Forms!DatabaseF.ProjectQSubF.Form.RecordSource = "Select * from ProjectsQ ORDER BY ProjectComplete ASC"
Forms!DatabaseF.ProjectQSubF.Form.Refresh
Else
MsgBox (True)
Forms!DatabaseF.ProjectQSubF.Form.RecordSource = "Select * from ProjectsQ ORDER BY ProjectComplete DESC "
Forms!DatabaseF.ProjectQSubF.Form.Refresh
ProjectCompleteOrgB = False
End If
End Sub