M
mps731
Sorry for the lack of "know how" on my part I am a database neophyte and am
trying to learn as much as I can. So....I am trying to run some code that on
button click a query will run looping through criteria set in table. However,
I keep getting a "Compile Error...Sub or Function not defined." Can someone
help? Here is my code:
Private Sub Detail_Click()
Dim rst As DAO.Recordset
Dim strSQL As String
Dim dbs As DAO.Database
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Definitions-DC List")
DoCmd.OpenQuery "1a-Del Temp Sales Penetation Tbl"
With rst
Do Until rst.EOF = True
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] & ""
DoCmd.RunSQL strSQL
DoCmd.OpenQuery "1e-Append Sales Penetration to Temp Tbl"
Loop
End Sub
trying to learn as much as I can. So....I am trying to run some code that on
button click a query will run looping through criteria set in table. However,
I keep getting a "Compile Error...Sub or Function not defined." Can someone
help? Here is my code:
Private Sub Detail_Click()
Dim rst As DAO.Recordset
Dim strSQL As String
Dim dbs As DAO.Database
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("Definitions-DC List")
DoCmd.OpenQuery "1a-Del Temp Sales Penetation Tbl"
With rst
Do Until rst.EOF = True
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] & ""
DoCmd.RunSQL strSQL
DoCmd.OpenQuery "1e-Append Sales Penetration to Temp Tbl"
Loop
End Sub