I am writing an SQL statement to populate the Choices available to a particular form field.
With SELECT usr_name FROM vt_userlookup
I get end up with a form field that gives me a dropdown with all of the user names from the usr_name field in the vt_userlookup table.
There are a lot of names so I need to be able to narrow it down so I don't have to scroll all of the names.
So I switched and put the same SQL statement
SELECT usr_name FROM vt_userlookup
in the Autosuggestions property of the form field.
I get better results because now it is searching as I type and populating a dropdown based on what I typed.
But it doesn't work the way I want because it populates the dropdown only on matching the beginning letters of the name (Jo brings up John Smith and Josh Barns, but not Ray Johnson)
I need it to return values that will allow me to enter any letters in the name (full text) and populate a dropdown for the form field with those.
I came close to getting what I want with the following select statement entered into the Choices property:
SELECT usr_name FROM vt_userlookup WHERE usr_name LIKE '%' +'Jo' + '%'
gives me a list of names where any of the names might have the letters Jo in them. Thus it returns both John Smith and Ray Johnson to my dropdown choices.
But what I really need is a version of this where I can replace dynamic content into the part of the select statement where 'Jo' is. I want to pull that dynamic content from the current form,
but do not know how to call a current form value into a form. Can someone show me how to do this? Or a better way?
I have tried it the following way, but it doesn't seem to work:
SELECT usr_name FROM vt_userlookup WHERE usr_name LIKE '%' + CURRENTFORM.field23 + '%'
Thanks in advance.
Bookmarks