sqlStmt problem

S

Steven

What is wrong with this statement?

Note: CurrentBatch is a variable that will be a table. ex: CurrentBatch =
Batch01

strSQL = "SELECT ChartOfAccounts.Active, Co.Status, Dept.Status, " &
CurrentBatch & ".* " + _
"FROM ((Co INNER JOIN " & CurrentBatch & " ON Co.Co = " & CurrentBatch &
".Co) INNER JOIN ChartOfAccounts ON " & CurrentBatch & ".Co =
ChartOfAccounts.Co AND Left(" & CurrentBatch & ".Account,6) =
ChartOfAccounts.Account) INNER JOIN Dept ON Right(" & CurrentBatch &
".Account,4) = Dept.DeptNum " + _
"WHERE (((ChartOfAccounts.Active)=0)) OR (((Co.Status)=0)) OR
(((Dept.Status)=0))"

I know I do not have the stucture correct INNER JOIN and then bringing in
another table to continue more INNER JOINS but I do not know how to correct
it.

Thank you,

Steven
 
S

Steven

Problem solved. I am learning that I have to make a query that works with
good structure and then in the SQL I can change things to be more specific
like Right( , ) or Left( , ) and then try it again and if ok then bring
it to my code then change to using variable if needed.
 

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