Our VB program has a feature where if a product item number button is
clicked, it searches in a particular folder for a jpeg image of that item
and displays it on a form. We have an on error condition that if the jpeg
isn't found the form still pops up, but it is blank.
Our database is old, however, and it allowed quotes within the item number,
to represent inches or feet. We can't have a jpeg file name with quotes in
it, as a file with a quote is not allowed in Windows. On a W98 machine, if
such an item is clicked, a blank form pops up, triggered by the on error.
But on a W2000 machine, we don't even get the on error; it gives us a sql
error. We're no longer allowing a quote symbol in our item numbers, but
until then, does anyone have any suggestions for a workaround?
EBS - 30 Apr 2004 15:45 GMT
Kathy,
The problem is that a single quote is used as a string delimiter in an SQL
statement.
You can write a simple function to replace any single quote with *two*
single quotes in your SQL statement.
So, an item number like this: ITEM123 - 2' becomes: ITEM123 - 2'' <-- two
single quotes, NOT a double quote!
This should eliminate the SQL error and allow you to use item numbers with
single quotes in them.
Regards,
Eric
>Our VB program has a feature where if a product item number button is
>clicked, it searches in a particular folder for a jpeg image of that item
[quoted text clipped - 8 lines]
>error. We're no longer allowing a quote symbol in our item numbers, but
>until then, does anyone have any suggestions for a workaround?