VB3: Setting listbox based on value of other listbox

VB3: Setting listbox based on value of other listbox

Post by David Rodrigu » Sun, 21 Jan 1996 04:00:00



I am attempting to populate a listbox based on the selected item of
another listbox.  I have attempted to use a Parameter Query, but have
been unsuccessful.  Below is the portion of my code.  Is it just that
VB3 cannot set the recordsource of a data control to a parameter query
or am I missing something.  Also, it this the best way to go about it?

    'the index holds the StateID
    stateid = listState.ItemData(listState.ListIndex)

    sqry = "PARAMETERS stateid integer; "
    sqry = sqry & "SELECT fldCityID, fldCityName FROM tblCitys "
    sqry = sqry & "WHERE fldStateID = stateid ORDER BY fldCityName"
    dataCitys.RecordSource = sqry
    dataCitys.Refresh

It is on the Refresh that I keep getting '1 parameter were expected,
but only 0 were supplied.  I guess I could put an If statement within
my Do loop to test before I do an 'AddItem' but that would seem to
slow the process even more.

Thanks in advance for any assistance.

David

 
 
 

1. SetFocus to listbox B after a DblClick in listbox A

[VFP 3.0]

Hi again all,

(Bill): Well, after much trial and error, my form is
working.  I took the combo box out of the tab order
(TabStop = .F.) and lo and behold, the lists responded
according to our specs. As it turns out, it works out
better this way in this case, since we didn't want
people to get to the combobox via tab, only via mouse
or its label's hotkey.  Credit goes to Todd for
serendipitous insight. (And there was much rejoicing.
"yay...")

Apologies for the odd line-breakage in the earlier
post; we changed newsgroup readers recently.

Cheers,

Bill & Todd * Alpine Land Information Services
Developing in VFP 3.0 and FP/W 2.x under Win 95 and
Win 3.x
 "The only easy day was yesterday"

2. Jaguar

3. Store Text in Listbox.Editing, and storing in Listbox

4. Removing an ASCII(160) or WhiteSpace in a varchar field

5. Help Needed How I Create Listbox That Look Like Multi Column Listbox

6. Powerbuilder-Informix Conectivity

7. FP 2.6 listbox base on table

8. SQL6.5 any bugs deleting fields and changing datatypes?

9. Listbox Picture property: 60 value limit?

10. Unique field values into listbox (D1)

11. Combo/Listbox: Numeric values?

12. Listbox.Text to integer value

13. initial value of listbox?