ADO & SQL string

W

Wendy

Hi
Just wondering how would I construct this SQL string to use inside VBA code:

F_PUPILS.PU_SEQ, tblAcadGrade.AcadYear, tblAcadGrade.FS_Set_Code,
tblAcadGrade.FS_Subject, tblAcadGrade.Autumn, tblAcadGrade.Spring,
tblAcadGrade.Summer, tblPastoralAcad.WiTutor, tblPastoralAcad.SuTutor,
tblPastoralAcad.SpTutor IN tblPastoralAcad ON F_PUPILS.PU_ROLL_NO =
tblPastoralAcad.PU_Roll_No
WHERE (((F_PUPILS.PU_SEQ)=[Forms]![FrmMyTutorGroup]![cmbTutees]))

I'm trying to work on a recordset, so need the SQL to build the set.

Thanks

Wendy
 
G

Guest

Hi Wendy!

Did you tried this:

strSQL = "SELECT F_PUPILS.PU_SEQ, tblAcadGrade.AcadYear,
tblAcadGrade.FS_Set_Code,
tblAcadGrade.FS_Subject, tblAcadGrade.Autumn, tblAcadGrade.Spring,
tblAcadGrade.Summer, tblPastoralAcad.WiTutor, tblPastoralAcad.SuTutor,
tblPastoralAcad.SpTutor IN tblPastoralAcad ON F_PUPILS.PU_ROLL_NO =
tblPastoralAcad.PU_Roll_No
FROM tblAcadGrade
WHERE (((F_PUPILS.PU_SEQ)=[Forms]![FrmMyTutorGroup]![cmbTutees]))"

Moreover, as the field PU_SEQ is from the table F_PUPILS, you need an INNER
JOIN clause to create a relationship between F_PUPILS and tblAcadGrade.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top