I am building a reporting engine that builds queries dynamically, based on imported xlsx files. The fieldnames can be different each time.
One issue I am having, is if the field names have the following:
"23# txt | fld"
It throws a 3075 error - syntax error.
As these characters are in the table names, how else can I reference them in the sql?
This is the vba I am using to set build the sql string, the field in question is created by the first part (strTable & curQues)
One issue I am having, is if the field names have the following:
"23# txt | fld"
It throws a 3075 error - syntax error.
As these characters are in the table names, how else can I reference them in the sql?
This is the vba I am using to set build the sql string, the field in question is created by the first part (strTable & curQues)
Code:
"SELECT [" & strTable & "]." & curQues & _
" FROM [" & QueryArray(x) & "] RIGHT JOIN [" & strTable & "] ON [" & QueryArray(x) & "].[" & qFieldDemo & "] = [" & strTable & "].[" & qFieldDemo & "]" & _
" GROUP BY [" & strTable & "].[" & Demofilter & "], [" & strTable & "].[" & qFieldDemo & "], [" & strTable & "]." & curQues & _
" HAVING ((([" & strTable & "].[" & Demofilter & "])=" & Chr(34) & "Employee" & Chr(34) & ") AND (([" & strTable & "].[" & qFieldDemo & "]) Like " & Chr(34) & cleanedqField & Chr(34) & " " & Chr(38) & " " & Chr(34) & "*" & Chr(34) & "));"