Jump to content

Error when trying to show assets with a Color or Year that has a single quote mark in it


Recommended Posts

If you have a Year with a single quote mark in it, like "1800's", then when you select that Year on the View tab you get an error like

Syntax error (missing operator) in query expression '[Assets].[YearMade] = '1800's' AND [Assets].[LocationID] <> 3 AND ...

Similarly, you get an error if a Color has a single quote.

I did not test all of the views, but you don't get this error if a Manufacturer has a single quote in the name. I suspect that this error will occur for all of the views which don't use a database record to store the property, such as Warranty Expiration, Expiring Leases, Color, Year, and Made Of.

Link to post
Share on other sites
  • 3 weeks later...

I believe that you will need to search and replace any single quotes with two single quotes when you make the query, like this:

Before

'[Assets].[YearMade] = '1800's' AND [Assets].[LocationID] <> 3 AND ...

After

'[Assets].[YearMade] = '1800''s' AND [Assets].[LocationID] <> 3 AND ...

Link to post
Share on other sites
  • 2 months later...
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...