SQL "Where" issue

  • Thread starter mps731 via AccessMonster.com
  • Start date
M

mps731 via AccessMonster.com

strSQL = " SELECT [Temp Product Essbase].[Fiscal Month Abbreviation], [Temp
Product Essbase].[Fiscal Month], [Temp Product Essbase].[Product Hierarchy],
[Temp Product Essbase].[Product Hierarchy Description], [Temp Product Essbase]
.[Financial Metrics], [Temp Product Essbase].[Financial Metrics Description],
[Temp Product Essbase].TY AS [DC 89 TY], [Temp Product Essbase].LY AS [DC
89LY], [Temp Product Essbase].LLY AS [DC 89 LLY], [Temp Product Essbase].
[Plan (RP)] AS [DC 89 Plan] INTO [1b-Demand Center Sales $ Seperation Tbl]" &
_
" FROM [Temp Product Essbase]" & _
" WHERE [Temp Product Essbase].[Financial Metrics
Description] = 'Sales $'" & _
" WHERE [Product Hierarchy] = " & rst![Demand Center] & ""

From the above code, I am trying to hardcode "Sales $" into this query. I get
an "item not found query". The field in the table is text. I am probably
missing a "'" somewhere. Any suggestions?
 
R

Rui

A quick look at the select statement reveals that you have two where clauses.
This is incorrect.

you need to change the last 'WHERE' clause to an 'AND'

ie.
Select fld1, fld2, fld3
From table
Where fld1 = condition1 AND fld2 = condition2

Take care
Rui
 

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