1

When I try to create a Report based on the following SELECT query in Micorsoft Access, i get the message "Syntax error (missing operator) in query expression 'Livestock>Mob Name/#'. The query itself works fine but when trying to put it into a report it comes up with the error.

SELECT 
    [Load DSE in Paddocks Currently].Livestock.[Mob Name/#], 
    Paddock.Paddock, Paddock.[Stocking rate], 
    [Load DSE in Paddocks Currently].Livestock.[Load(DSE)]
FROM 
    Paddock 
LEFT JOIN 
    [Load DSE in Paddocks Currently] ON Paddock.[Paddock] = [Load DSE in Paddocks Currently].[Livestock Movement].[Moved In Paddock(s)].[Value]
WHERE 
    ((([Load DSE in Paddocks Currently].[Livestock Movement].[Moved In Paddock(s)].Value) IS NOT NULL));
FROM Paddock LEFT JOIN [Load DSE in Paddocks Currently] ON Paddock.[Paddock] = [Load DSE in Paddocks Currently].[Livestock Movement].[Moved In Paddock(s)].[Value] WHERE ((([Load DSE in Paddocks Currently].[Livestock Movement].[Moved In Paddock(s)].Value) Is Not Null));'

I want the report to be grouped by Paddocks with mobs and their DSE load summed under each paddock.

  • Is `[Load DSE in Paddocks Currently].[Livestock Movement].[Moved In Paddock(s)].[Value]` a lookup or multi-value field? If so, replace it with a normal child table. – Gustav Sep 10 '21 at 06:04
  • @Gustav It is a multi-value field, as there are multiple mobs within a paddock. Where would i replace it? im justs self taught, so this is all very new for me. – Madison Read Sep 10 '21 at 06:16
  • New to me as well, as I never use them. But I located [Alternative to multi-valued fields in MS Access](https://stackoverflow.com/questions/13505838/alternative-to-multi-valued-fields-in-ms-access). – Gustav Sep 10 '21 at 06:26
  • Thankyou. I have somehow managed to get it to work, but relating the query with the lookup tables. – Madison Read Sep 10 '21 at 08:06

1 Answers1

1

The error message is pointing to a problem with the field [Mob Name/#]. Since this name contains a slash (/), you must quote it with square brackets. It seems that in some expression, it is written without square brackets, and thus, the slash (/) is interpreted as division, which leads to the error.

SQL Police
  • 4,127
  • 1
  • 25
  • 54