D
dmoney
The query below is giving me fits. I am using vba to pull in data from access.
The query below blows up when I use the variable plnt in the having clause.
& "HAVING (((zbrdist.Plnt)='" & plnt & "'
I have several other queries that have the same clause and no problems.
Any ideas?
Here is the full string
strsql = "SELECT zbrdist.Plnt, Sum(zbrdist.[Value TCur]) AS [SumOfValue
TCur], zbrdist.Material, Controllers.Name, Controllers.Telephone,
zbrdist.[WBS Element], zbrdist.[Grouping WBS el], DistributedAnalyst.Analyst,
DistributedAnalyst.Comments, DistributedAnalyst.Category,
DistributedAnalyst.Date, DistributedAnalyst.Actionee " _
& "FROM ((zbrdist LEFT JOIN PeggTassQuerry ON zbrdist.PurchaseDoc =
PeggTassQuerry.[Purchase Doc]) LEFT JOIN Controllers ON zbrdist.Material =
Controllers.Material) LEFT JOIN DistributedAnalyst ON zbrdist.Material =
DistributedAnalyst.Material " _
& "GROUP BY zbrdist.Plnt, zbrdist.Material, Controllers.Name,
Controllers.Telephone, zbrdist.[WBS Element], zbrdist.[Grouping WBS el],
DistributedAnalyst.Analyst, DistributedAnalyst.Comments,
DistributedAnalyst.Category, DistributedAnalyst.Date,
DistributedAnalyst.Actionee " _
& "HAVING (((zbrdist.Plnt)='" & plnt & "' Or (zbrdist.Plnt) Is Null) AND
((zbrdist.[Grouping WBS el]) Not Like 'v*'));"
Thanks
The query below blows up when I use the variable plnt in the having clause.
& "HAVING (((zbrdist.Plnt)='" & plnt & "'
I have several other queries that have the same clause and no problems.
Any ideas?
Here is the full string
strsql = "SELECT zbrdist.Plnt, Sum(zbrdist.[Value TCur]) AS [SumOfValue
TCur], zbrdist.Material, Controllers.Name, Controllers.Telephone,
zbrdist.[WBS Element], zbrdist.[Grouping WBS el], DistributedAnalyst.Analyst,
DistributedAnalyst.Comments, DistributedAnalyst.Category,
DistributedAnalyst.Date, DistributedAnalyst.Actionee " _
& "FROM ((zbrdist LEFT JOIN PeggTassQuerry ON zbrdist.PurchaseDoc =
PeggTassQuerry.[Purchase Doc]) LEFT JOIN Controllers ON zbrdist.Material =
Controllers.Material) LEFT JOIN DistributedAnalyst ON zbrdist.Material =
DistributedAnalyst.Material " _
& "GROUP BY zbrdist.Plnt, zbrdist.Material, Controllers.Name,
Controllers.Telephone, zbrdist.[WBS Element], zbrdist.[Grouping WBS el],
DistributedAnalyst.Analyst, DistributedAnalyst.Comments,
DistributedAnalyst.Category, DistributedAnalyst.Date,
DistributedAnalyst.Actionee " _
& "HAVING (((zbrdist.Plnt)='" & plnt & "' Or (zbrdist.Plnt) Is Null) AND
((zbrdist.[Grouping WBS el]) Not Like 'v*'));"
Thanks