Copy link to clipboard
Copied
I hope I'm in the correct forum!
I am working on a data-entry screen that interfaces with a database for pre-determined entries. The user will select the member's last name, no problem here, then using that last name, be given a list of first names that match the last name. Here's what I have so far:
<CFQUERY DATASOURCE="cfissues" Name="LNameQry">
SELECT LastName
FROM Members
ORDER BY LastName
</CFQUERY
<CFQUERY DATASOURCE="cfissues" Name="FNameQry">
SELECT FirstName
FROM Members
WHERE LastName = #LastName# ('#LastName#') (#FORM.LastName#)
</CFQUERY
<!--- ================== --->
<CFSELECT NAME="LastName"
QUERY = "LNameQry"
VALUE= "Value"
etc.
</CFSELECT>
The user selects a Member Last Name. Using this Last Name, I would like to execute the FNameQry query that retrieves all the first names that match that last name chosen by the CFSELECT statement. That way, the dropdown box for the First Name field contains only the qualifying names (not all 7,000 on the database!). I've more to do beyond that, but just getting this first part to work would be a major accomplishment.
I've used varous combinations of the last name selected by the CFSELECT to execute FNameQry, but nothing seems to work. I keep getting an error on LASTNAME not defined.
I guess I need to (somehow) define a variable that would be populated with the value selected in the CFSELECT statement and use that in the FNameQry?
hi
use isdefined("form.LastName") for FNameQry
Copy link to clipboard
Copied
hi
use isdefined("form.LastName") for FNameQry