任何人都可以使用Access 2013数据库。 如果选中一个方框,我有一个表格和一个带有七个复选框的表格,其中包含一周中的日期 我希望它填写一个文本框字段,并与任何其他检查日连接。 然而,我完成它的方式是有效的,而不是七次重复七天的代码。 任何帮助或建议将不胜感激。
Option Compare Database
Dim DMon As String
Dim DTue As String
Dim DWed As String
Dim DThur As String
Dim DFri As String
Dim DSat As String
Dim DSun As String
--------------------------------------------------------------
' **************** Monday ***********
Private Sub Day_Mon_Click()
If Me.Day_Mon = True Then
DMon = "Monday/"
Else
DMon = ""
End If
' ***************
If Me.Day_Tue = True Then
DTue = "Tuesday/"
Else
DTue ""
End If
Me.Days.Value = Dmon & DTue & DWed & DThur & DFri & DSat & DSun
End Sub
' *************** Tuesday **********
Private Sub Day_Tue_Click()
If Me.Day_Mon = True Then
DMon = "Monday/"
Else
DMon = ""
End If
' ***************
If Me.Day_Tue = True Then
DTue = "Tuesday/"
Else
DTue ""
End If
Me.Days.Value = Dmon & DTue & DWed & DThur & DFri & DSat & DSun
End Sub