Thanks again for your help Duane, i've been thinking more about your answer about adding a value to the table which i did with "BExST", but that lead to some problems so what i did was for all
session types "B", "Ex", "ST" i added a "X" to strSessionGrp.
I then changed the value expression in the query to:
Code:
Val: Max(Day([TheDate])) & Chr(13) & Chr(10) & Max([strSessionKey]) & Chr(13) & Chr(10) & Max([strSessionGrp]) & Chr(13) & Chr(10) & Min([IsHoliday])
so in the text boxes i now have
Code:
2
B
X
0[code]
or
[code]2
-1
i thought everything was working perfectly and i've been creating the forms when i realised the forms were being populating incorrectly.
So any child (lngChildID) can go to any of the 6 clubs (lngClubID], some children can go to more then one club, a breakfast or after school club. Each club does have a unique ID number and so does each child.
the problem is that the form is pulling information from both clubs for some reason.
test date
Club ID, ChildID, dteSessionDates, lngBookingID, Surname, Forename, strSessionKey, strSessionGrp
376, 605, 24/04/2013, 47491, Doe, John, B, X
377, 605, 23/04/2013, 47490, Doe, John, B, X
my version of your qcarDateShipTo is
Code:
SELECT Format([TheDate],"mmm-yy") AS expr2, tblDates.TheDate, tblDates.isHoliday, Year([TheDate]) AS Expr1, tblSessionsBuildNewPerm.lngChildID, tblSessionsBuildNewPerm.lngClubsID
FROM tblDates, tblSessionsBuildNewPerm
GROUP BY Format([TheDate],"mmm-yy"), tblDates.TheDate, tblDates.isHoliday, Year([TheDate]), tblSessionsBuildNewPerm.lngChildID, tblSessionsBuildNewPerm.lngClubsID
HAVING (((Format([TheDate],"mmm-yy"))=Forms!frmAvailability4StCathBCMain!cmbMonthYear) And ((tblSessionsBuildNewPerm.lngChildID)=Forms!frmAvailability4StCathBCMain!cmbChildSelectt) And ((tblSessionsBuildNewPerm.lngClubsID)=Forms!frmAvailability4StCathBCMain!cmbClubSelect))
ORDER BY tblDates.TheDate;
results from using "Apr-13", ChildID 605, ClubID 376:
expr2, TheDate, isHoliday, Expr1, lngChildID, lngClubsID
Apr-13, 01/04/2013, Yes, 2013, 605, 376
Apr-13, 02/04/2013, Yes, 2013, 605,376
.....
Apr-13, 23/04/2013, No, 2013, 605, 376
Apr-13, 24/04/2013, No, 2013, 605, 376
my version of the qxtbActivitySchedule crosstab is
Code:
TRANSFORM Max(Day([TheDate])) & Chr(13) & Chr(10) & Max([lngAMPMSession]) & Chr(13) & Chr(10) & Min([IsHoliday]) AS Val
SELECT Year([TheDate]) AS YR, Month([TheDate]) AS MTH, qryAvailability5WestJesMain.lngClubsID, qryAvailability5WestJesMain.lngChildID
FROM qryAvailability5WestJesMain LEFT JOIN tblSessionsBuildNewPerm ON (qryAvailability5WestJesMain.lngChildID = tblSessionsBuildNewPerm.lngChildID) AND (qryAvailability5WestJesMain.TheDate = tblSessionsBuildNewPerm.dteSessionDate)
GROUP BY Year([TheDate]), Month([TheDate]), qryAvailability5WestJesMain.lngClubsID, qryAvailability5WestJesMain.lngChildID
ORDER BY Year([TheDate]), Month([TheDate]), qryAvailability5WestJesMain.lngClubsID, qryAvailability5WestJesMain.lngChildID
PIVOT [TheDate]-DateAdd("d",-Weekday(DateSerial(Year([TheDate])+2,Month([TheDate]),1)),DateSerial(Year([TheDate]),Month([TheDate]),1)) In (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37);
results from "Apr-13", lngChildID: 605, lngClubsID: 376 are:
YR, MTH, lngClubsID, lngChildID,1,2,3,4,5,6.....
2013, 4, 376, 605,
when i run the form based off the queries, the form pulls the data from both clubs lngClubsID 376 and 377. Even if i put the clubID, childID, month-yr in the criteria of the query, it will still display on the form information from both clubs.
Any ideas where i'm going wrong