In stead of a listview I have created a form with different subform which have the function of a listview. Now I want to create a listview as subform which should look like following:
My table structure is as follows:
Table 1 - DaySelection
DaySelectionId
Name
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Child Table – DaySelectionSub
DaySelectionFK
DaySelectionSubId
DayNumber (1 for Sunday, 2 for Monday, 3 for Tuesday etc.)
I was experimenting with the following code:
But somehow it will not check the appropriate Boolean fields in the table DaySelection.
Code:
Name Monday Tuesday Wednesday Thursday Friday Saturday Sunday
Weekend X X
Weekdays X X X X X
Daily X X X X X X X
My table structure is as follows:
Table 1 - DaySelection
DaySelectionId
Name
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
Child Table – DaySelectionSub
DaySelectionFK
DaySelectionSubId
DayNumber (1 for Sunday, 2 for Monday, 3 for Tuesday etc.)
I was experimenting with the following code:
Code:
Private Sub Form_Load()
Dim Monday As Boolean
Dim rs As dao.Recordset
Set rs = CurrentDb.OpenRecordset("DaySelection", dbOpenTable)
Do While Not rs.EOF
rs.Edit
If IsSelectedMonday(rs!DaySelectionId) Then
rs!Monday = True
Else
rs!Monday = False
End If
rs.Update
rs.MoveNext
Loop
End Sub
Public Function IsSelectedMonday (ID As Long) As Boolean
If Not Nz(DLookup("DayNumber", "DaySelectionSub", "DaySelectionId = " & ID _
& " AND Dag = " & 1), 0) = 0 Then
IsSelected = True
End If
End Function
But somehow it will not check the appropriate Boolean fields in the table DaySelection.