Due to reasons beyond my understanding, I have compiled a Diary-type database for a Counselling clinic. As such, they need to record what the current session number is when that session is booked. However, because this number is pulled from a collated query (where all Attendance records are kept), if I add the Session Number to the Main Booking Form, it will not allow the form to be edited (due to the link with the 'Group By' query for Attendance rates).
To get around this, I have created a Subform that calculates the Session Number for me. It works great. It automatically calculates the Session Number whilst allowing me to edit the Appointment details. But when the Main form saves, it has to save the 'SessionNumber' value from the Subform to the Table that records all the information from the Main form (Client, Counsellor, Date, Time, etc...).
How do I do this?
I've tried:
Me.Subform.FieldName
Form.Subform.FieldName
Forms!Subform.FieldName
and probably more along that line, but none of them work. The save has to run passed an "UPDATE" SQL code because the Counsellor they are booking the appointment with may not necessarily be their assigned Counsellor. The SQL code is currently:
What value do I assign at the above Asterix for 'nwNumber'?
To get around this, I have created a Subform that calculates the Session Number for me. It works great. It automatically calculates the Session Number whilst allowing me to edit the Appointment details. But when the Main form saves, it has to save the 'SessionNumber' value from the Subform to the Table that records all the information from the Main form (Client, Counsellor, Date, Time, etc...).
How do I do this?
I've tried:
Me.Subform.FieldName
Form.Subform.FieldName
Forms!Subform.FieldName
and probably more along that line, but none of them work. The save has to run passed an "UPDATE" SQL code because the Counsellor they are booking the appointment with may not necessarily be their assigned Counsellor. The SQL code is currently:
Code:
Dim nwNumber As Integer
Dim nwCounsellor As String
Me.frmSessionNumber.Form.Requery
nwNumber = ************
nwCounsellor = Me.ApptWith
DoCmd.SetWarnings False
If Me.Dirty Then
Me.Dirty = False
strSQL = "UPDATE TBL_Diary_Booking SET [Counsellor] = '" & nwCounsellor & "' , [SessionNumber] = " & nwNumber & ""
strSQL = strSQL & " WHERE (TBL_Diary_Booking.BookingID = " & Me.BookingID & ");"
DoCmd.RunSQL strSQL
End If
DoCmd.Close
DoCmd.SetWarnings True
What value do I assign at the above Asterix for 'nwNumber'?