Need two SELECTs in one.

  • I have a page where the user picks people's names from a dropdown list. This submits that person's PersonID to the database and stores it in a table called EVENT_TEACHERS. The next page they go to displays which people have been selected by joining the personID from EVENT_TEACHERS with a table called vwStaffList4Assessment (this contains first names, last names person ID and the number to the place they work which is called DVN). That was all good.

    Now they want me to make it so there is a dropdown list AND a textbox for the times when someone isn't in our DB (thus they will have no personID). I have got it to submit the persons name to EVENT_TEACHERS if they type the name and the personID if they click from the list. (I have also tried submitting these two to different table but still have no luck with my problem).

    My problem is when I go to display the people that have been added, I can't show the name of the people that have been typed because I can't get my SELECT to not select from vwStaffList4Assessment(because I need the names for the PersonID).

    I've tried making it so it just submits the name without the person ID but I can't do this without getting rid of the logic to prevent a name from showing in the dropdown once it has been picked.

    Any ideas on how I can do this.

    Sorry for the confusing explanation. My original SELECT statement without anything for the text box (called PersonName) is included below.

    str = "SELECT EVENT_TEACHERS.PersonID, EVENT_TEACHERS.PersonName, EVENT_TEACHERS.iAsmtID, vwStaffList4Assessment.FirstName1, vwStaffList4Assessment.LastName1, vwStaffList4Assessment.LastName2, vwStaffList4Assessment.DVN, vwStaffList4Assessment.PersonID FROM vwStaffList4Assessment INNER JOIN EVENT_TEACHERS ON vwStaffList4Assessment.PersonID = EVENT_TEACHERS.PersonID WHERE (((vwStaffList4Assessment.PersonID) In (SELECT PersonID FROM EVENT_TEACHERS WHERE iAsmtID =" & iAsmtID & " AND EVENT_TEACHERS.DVN=" & DVN & ")) AND ((EVENT_TEACHERS.iAsmtID)=" & iAsmtID & ")AND vwStaffList4Assessment.DVN=" & DVN & ") ORDER BY EVENT_TEACHERS.PersonID"

  • Actually we are using 2k5 but I don't think it makes a difference on this.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply