DreamGenius
Annoying Questionner
- Local time
- Today, 19:15
- Joined
- Jul 29, 2004
- Messages
- 116
Okay, having ascertained that RowID and RowNum isn't available in Access via the Search facility, I'll throw my quandry open to the combined wisdom and collective minds of this forum.
I have a database which tracks Training Requests and the Dates booked are records in tblBookDays, with BookDayId (Autonumber), BookingID (which is the Foreign Key to tblBookings), Employee (Text), Program (Number), BookDate (Date), Attended (Boolean), Canceled (Boolean) plus other text fields.
For any given Booking(ID), there may be multiple entries in this table, but the Unique Key is on Employee + Program + BookDate, meaning no person can be booked on the same program on the same date.
For the purposes of reporting, I'm trying to get the dates concatenated into a string, using a query like this:
where qryAttended is simply
the output of which is concatenated using the following query
The challenge is that, by using the right-most digit from BookDaysID to separate out the dates, the dates aren't always in chronological order. You need to see the attached file to understand what I mean by that - see the rows where BookingID = 1738. The first block of data is from the Cross Tab query, the second from the concatenation query.
The reason for concatenating the dates is to simply display them on one line of a report but I'm stumped - I'll listen to any solution, however wacky, if it gets me where I want to go.
I have a database which tracks Training Requests and the Dates booked are records in tblBookDays, with BookDayId (Autonumber), BookingID (which is the Foreign Key to tblBookings), Employee (Text), Program (Number), BookDate (Date), Attended (Boolean), Canceled (Boolean) plus other text fields.
For any given Booking(ID), there may be multiple entries in this table, but the Unique Key is on Employee + Program + BookDate, meaning no person can be booked on the same program on the same date.
For the purposes of reporting, I'm trying to get the dates concatenated into a string, using a query like this:
Code:
TRANSFORM Max(BookDate) AS MaxDate
SELECT BookingID,
COUNT (AssociateID) AS Associates
FROM qryAttended
GROUP BY BookingID
ORDER BY BookingID
PIVOT "Date0" & Right(CStr([BookDaysID]),1);
Code:
SELECT BookDaysID, BookingID, AssociateID, ProgramID, CourseID, BookDate, Notes, Attended, Canceled, Replaced, Charged, Reason, UpdatedBy, UpdatedOn
FROM tblBookDays
WHERE Attended = True
AND Canceled = False
ORDER BY BookingID, BookDate;
Code:
SELECT BookingID,
Replace(
Trim(
IIf([Date00] Is Null,Null,[Date00] & " ") &
IIf([Date01] Is Null,Null,[Date01] & " ") &
IIf([Date02] Is Null,Null,[Date02] & " ") &
IIf([Date03] Is Null,Null,[Date03] & " ") &
IIf([Date04] Is Null,Null,[Date04] & " ") &
IIf([Date05] Is Null,Null,[Date05] & " ") &
IIf([Date06] Is Null,Null,[Date06] & " ") &
IIf([Date07] Is Null,Null,[Date07] & " ") &
IIf([Date08] Is Null,Null,[Date08] & " ") &
IIf([Date09] Is Null,Null,[Date09])
)," ",", "
) AS Bookings
FROM tabAttended;
The reason for concatenating the dates is to simply display them on one line of a report but I'm stumped - I'll listen to any solution, however wacky, if it gets me where I want to go.