M
MJC
Hi. I checked the reponses from earlier questions but I have DAO in my
references, so I don't think that's my difficulty here. I have the following
code in a module"
Set DB = CurrentDb
Set rsRM = DB.OpenRecordset("SELECT SalesDivision.DivisionID,
SalesDivision.Division, SalesRegion.RegionID, SalesRegion.Region,
[Employees].[FirstName] & ' ' & [Employees].[LastName] AS RMDesc,
Employees.LastName, Employees.FirstName, Employees.Email, Employees_1.Email
AS DOSemail FROM ((SalesDivision LEFT JOIN SalesRegion ON
SalesDivision.DivisionID = SalesRegion.DivisionID) LEFT JOIN Employees ON
SalesRegion.MainID = Employees.MainID) LEFT JOIN Employees AS Employees_1 ON
SalesDivision.MainID = Employees_1.MainID WHERE
(((SalesDivision.DivisionID)='EN02' Or (SalesDivision.DivisionID)='EN71' Or
(SalesDivision.DivisionID)='EN72' Or (SalesDivision.DivisionID)='EN73'))
ORDER BY SalesDivision.Division, SalesRegion.Region")
If Not rsRM.EOF Then
Do While Not rsRM.EOF
Set rsPlanM1 = DB.OpenRecordset("SELECT * " & _
"FROM [PlanRegion] " & _
"WHERE [RegionID] = " & rsRM![RegionID] & " AND [YearID] = 2005 AND
[MonthID] = 7")
rsRM is just a heirarchy of management people. RM stands for Region Manager.
The RegionID field from SalesRegion is text.
Plan Region has four fields: RegionID (text), YearID (num), MonthID (num),
Plan (num)
Somehow I think there's a problem with WHERE [RegionID] = " &
rsRM![RegionID] & " even though both RegionID fields are text.
Any thoughts would be great. Thanks!
references, so I don't think that's my difficulty here. I have the following
code in a module"
Set DB = CurrentDb
Set rsRM = DB.OpenRecordset("SELECT SalesDivision.DivisionID,
SalesDivision.Division, SalesRegion.RegionID, SalesRegion.Region,
[Employees].[FirstName] & ' ' & [Employees].[LastName] AS RMDesc,
Employees.LastName, Employees.FirstName, Employees.Email, Employees_1.Email
AS DOSemail FROM ((SalesDivision LEFT JOIN SalesRegion ON
SalesDivision.DivisionID = SalesRegion.DivisionID) LEFT JOIN Employees ON
SalesRegion.MainID = Employees.MainID) LEFT JOIN Employees AS Employees_1 ON
SalesDivision.MainID = Employees_1.MainID WHERE
(((SalesDivision.DivisionID)='EN02' Or (SalesDivision.DivisionID)='EN71' Or
(SalesDivision.DivisionID)='EN72' Or (SalesDivision.DivisionID)='EN73'))
ORDER BY SalesDivision.Division, SalesRegion.Region")
If Not rsRM.EOF Then
Do While Not rsRM.EOF
Set rsPlanM1 = DB.OpenRecordset("SELECT * " & _
"FROM [PlanRegion] " & _
"WHERE [RegionID] = " & rsRM![RegionID] & " AND [YearID] = 2005 AND
[MonthID] = 7")
rsRM is just a heirarchy of management people. RM stands for Region Manager.
The RegionID field from SalesRegion is text.
Plan Region has four fields: RegionID (text), YearID (num), MonthID (num),
Plan (num)
Somehow I think there's a problem with WHERE [RegionID] = " &
rsRM![RegionID] & " even though both RegionID fields are text.
Any thoughts would be great. Thanks!