I need to check at registration time if a predefined personal code entered by a user in a dblookup-type custom field, named "cb_codiceassistito", does exist in a table named "pazienti".
The query:
Code:
SELECT p.codice, p.codusl, p.userid from pazienti p
WHERE p.codusl = '417SC440'
AND p.userid is NULL
does work if executed directly querying the db (i.e. with Navicat) AND if hard-write the code (417SC440) in the field's query definition box.
This is a screenshot from Navicat demonstrating the successful query's execution:
The query fails, popping up the "invalid code" message box, if I feed the query with the very same code value, this time entered by the user in the corresponding field on the registration form (the cb field [cb_codiceassistito])
The definition of the query in the CB field definiton screen is the following:
This is the error showed upon submission:
It seems a syntax error, but I can't pinpoint it.
Could someone help?
Thanks in advance.