Can anyone help me figure out what is wrong with this select stament. If I take the last line out, everything works but I need the last line. Is there a syntax error that I can't see . Any suggestions please
Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("TEST"
strsql = "SELECT " & strtblname & ".NAME, " & strtblname & ".CITY, " & strtblname & ".HOURS, "
strsql = strsql & "Sum(" & strtblname & ".HOURS) AS [The Value] "
strsql = strsql & "INTO" & " XTBTABLE "
strsql = strsql & "from " & strtblname & " "
strsql = strsql & "GROUP BY " & strtblname & ".NAME, " & strtblname & ".CITY, " & strtblname & ".TYPEHOURS"
strsql = strsql & "having" & (strtblname & ".NAME"="[Forms]![frmcrosstab]![name];"
qdf.SQL = strsql
Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("TEST"
strsql = "SELECT " & strtblname & ".NAME, " & strtblname & ".CITY, " & strtblname & ".HOURS, "
strsql = strsql & "Sum(" & strtblname & ".HOURS) AS [The Value] "
strsql = strsql & "INTO" & " XTBTABLE "
strsql = strsql & "from " & strtblname & " "
strsql = strsql & "GROUP BY " & strtblname & ".NAME, " & strtblname & ".CITY, " & strtblname & ".TYPEHOURS"
strsql = strsql & "having" & (strtblname & ".NAME"="[Forms]![frmcrosstab]![name];"
qdf.SQL = strsql