Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Multiple Queries in same data-entry form

Explorer ,
Jul 17, 2009 Jul 17, 2009

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?

1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Jul 19, 2009 Jul 19, 2009

hi

use isdefined("form.LastName") for FNameQry

Translate
Contributor ,
Jul 19, 2009 Jul 19, 2009
LATEST

hi

use isdefined("form.LastName") for FNameQry

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources