
Originally Posted by
JoeM
If you have spaces or special characters like "#" in field names, you need to enclose the field name in square brackets, i.e.
Code:
SELECT ProcedureLog.Status, ProcedureLog.[Test No], ProcedureLog.TestDate, ProcedureLog.[Test Ident #]
FROM ProcedureLog
WHERE (((ProcedureLog.Status)="SAT"))
ORDER BY ProcedureLog.[Test No];
While helpful it doesn't answer the original question or correct the syntax error. The actual header text in my table is TWR_NO, but in order to have it make sense for the purpose of this thread I changed it to Test Ident #. Where the syntax error is coming from is where I'm trying to incorporate the change orange suggested. The actual code reads:
Code:
SELECT ProcedureLog.Status, ProcedureLog.TP_No, ProcedureLog.TestDate, ProcedureLog.TWR_No
FROM ProcedureLog
WHERE (((ProcedureLog.Status)="PSAT"))
ORDER BY ProcedureLog.TP_No;
This is what I'm trying to change it to per the suggested code:
Code:
SELECT ProcedureLog.Status, ProcedureLog.TP_No, ProcedureLog.TestDate, ProcedureLog.TWR_No
FROM ProcedureLog
WHERE (((ProcedureLog.Status)="PSAT")) and
testdate = (select Min(W.[testdate]) from Table as W)
ORDER BY ProcedureLog.TP_No;