Kayleigh
Member
- Local time
- Today, 15:43
- Joined
- Sep 24, 2020
- Messages
- 706
Hi
I have a continuous form based on a crosstab query. The data at the moment is just displaying ID numbers, however it is simple to lookup more meaningful data from the ID. However I am having trouble looping through the fields and assigning the new data to the textbox. When I try all the boxes are filled with the same text. How can I improve this?
I have a continuous form based on a crosstab query. The data at the moment is just displaying ID numbers, however it is simple to lookup more meaningful data from the ID. However I am having trouble looping through the fields and assigning the new data to the textbox. When I try all the boxes are filled with the same text. How can I improve this?
Code:
With Me.Recordset
.MoveFirst
Do While Not .EOF
If Not IsNothing(Me.Monday) Then
subj = DLookup("fldSubjectName", "qrySessionsAllExtended", "[fldSessionID] =" & Me.Monday)
Debug.Print subj
room = DLookup("fldRoomName", "qrySessionsAllExtended", "[fldSessionID] =" & Me.Monday)
Debug.Print room
stf = DLookup("cfStaffName", "qrylkpStaffWithTitle", "[fldStaffID] = " & DLookup("fldStaffID", "qrySessionsAllExtended", "[fldSessionID] =" & Me.Monday))
Debug.Print stf
Forms!frmStudentTimetable!txtMon.Value = Me.Monday
Me.txtMon.Visible = True
End If
.MoveNext
Loop
End With