G
Guest
As I can't write SQL, I use the query builder to build a query, then show me
the SQL version and then I copy and paste this into my Access VB to define my
recordsets.
This usally works fine, but on this occassion I've spent ages trying to get
it right and can't.
My application books people onto courses and sends them an email if a
certain box is ticked.
The form "Bookings" has a sub form "Attendees", so I can scroll through each
record in "Bookings" and see which "Attendees" are due to attend the course
and if their box is ticked include them in the recordset for the email.
The direct copy from the SQL design is:-
SELECT tblAttendees.UCLANEmail
FROM tblAttendees
WHERE (((tblAttendees.EventRef)=[Forms]![frmBookings]![EventRef]) AND
((tblAttendees.Email)=Yes));
If for example I want to get a recordset for course number 1, the following
SQL works fine:
SELECT tblAttendees.UCLANEmail
FROM tblAttendees
WHERE tblAttendees.EventRef = 1 AND (tblAttendees.Email = True)
but any attempt to substiute the "1" for the ref from the "bookings" form
results in a crash.
If anyone one could help, and show me where I'm going wrong I'd be very
grateful.
thanks
Winger
the SQL version and then I copy and paste this into my Access VB to define my
recordsets.
This usally works fine, but on this occassion I've spent ages trying to get
it right and can't.
My application books people onto courses and sends them an email if a
certain box is ticked.
The form "Bookings" has a sub form "Attendees", so I can scroll through each
record in "Bookings" and see which "Attendees" are due to attend the course
and if their box is ticked include them in the recordset for the email.
The direct copy from the SQL design is:-
SELECT tblAttendees.UCLANEmail
FROM tblAttendees
WHERE (((tblAttendees.EventRef)=[Forms]![frmBookings]![EventRef]) AND
((tblAttendees.Email)=Yes));
If for example I want to get a recordset for course number 1, the following
SQL works fine:
SELECT tblAttendees.UCLANEmail
FROM tblAttendees
WHERE tblAttendees.EventRef = 1 AND (tblAttendees.Email = True)
but any attempt to substiute the "1" for the ref from the "bookings" form
results in a crash.
If anyone one could help, and show me where I'm going wrong I'd be very
grateful.
thanks
Winger