listbox/database question

Results 1 to 4 of 4

Thread: listbox/database question

  1. #1
    Join Date
    Dec 1969

    Default listbox/database question

    Hi all,<BR><BR>I&#039m an amatuer at this and I now have a problem that I am not sure as to how I should proceed. I have a list box with x number of states (populated from an Access table) and once the user selects one I need a second list box to be populated with the cities of that state. Would this involve a stored procedure? Can I do one of those in Access or is it just SQL Server? The way the tables are setup now I have a one to many relationship from the record id field to the state id field of the city table. What is the best way to proceed? <BR><BR>Thanks for any and all help.<BR>Justin

  2. #2
    Franco Guest

    Default RE: listbox/database question

    One way to do this could be to use frames and forms. Set up a frameset with two frames (borders can be set to invisible to give the whole thing a seamless look). Set up one page (can be .htm) with your "state" listbox. Add a submit button in the form pointing to the second page or alternatively trap an appropriate event of the listbox (eg on_change) and pass values through that way.<BR>In either case, set up the second page as an ASP page which will accept the incoming values and fire off a SQL statement such as:<BR>"SELECT CityName FROM CityTable WHERE StateID=" & ChosenStateID<BR><BR>Hope that gives you some idea...

  3. #3
    serdar Guest

    Default RE: listbox/database question


  4. #4
    Join Date
    Dec 1969

    Default RE: listbox/database question

    Another way to do this (if you cannot use frames) is to involve Javascript. Have 2 listboxes on the same page the 1st one with the onChange event. When it changes it loads the appropriate cities that belong to that state into the 2nd list box. The only other thing you&#039d have to do is use an onLoad event in the body tag so that the city box will be populated when the page loads. If you are interested in the code, e-mail me at .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts