Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Flakey combobox behavior?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00426857
Message ID:
00426862
Vues:
19
Hi!

First of all, you do not need code either in the when event or in the Valid of Complaint combobx. Because it doing the same query. Why query data twice?
Another note is that the most proper event for query data in your case is GotFocus event of subcomplaint combobox.
In addition, try following:

THISFORM.cboSubComplnt.RowSource = THISFORM.cboSubComplnt.RowSource
THISFORM.cboSubComplnt.Requery
THISFORM.cboSubComplnt.Refresh

HTH.

>I have two comboboxes, one above the other on a form. The first combobox contains choices for Complaints. The second combobox contains choices for Subcomplaints. When you choose a Complaint from the first combobox, it fills the second Sub-complaint combobox drop-down list with Sub-complaints from a lookup table. The problem I am having is that sometimes the Sub-complaint combobox shows all Sub-complaints related to that Complaint, but sometimes it only shows one Sub-complaint for that same Complaint. Each combobox is filled with values from an array with the arrays being built from a lookup table.
>
>Complaints codes = 28 in my lookup table.
>Sub-complaint codes = Mailcode in my lookup table.
>
>Here is code in Valid Event of Complaint combobox:
>
>IF !USED('lookup')
>	USE \data\reference\lookup IN 0 SHARED
>ENDIF
>
>SELECT lookup.desc, lookup.mailcode, lookup.code FROM lookup ;
>WHERE lookup.code = 28 AND THIS.List(THIS.ListIndex,2) = ALLT(lookup.mailcode) ;
>INTO ARRAY asubcomplaint
>*!* THISFORM.cboSubComplnt.DisplayValue = ""
>THISFORM.cboSubComplnt.Requery
>THISFORM.cboSubComplnt.Refresh
>
>IF USED('lookup')
>	USE IN lookup
>ENDIF
>
>
>Here is code in the When Event of the Sub-complaint combobox:
>
>IF !USED('lookup')
>	USE \data\reference\lookup IN 0 SHARED
>ENDIF
>
>SELECT lookup.desc, lookup.mailcode, lookup.code FROM lookup ;
>WHERE lookup.code = 28 AND THISFORM.cboComplnt.List(THISFORM.cboComplnt.ListIndex,2) = ALLT(lookup.mailcode) ;
>INTO ARRAY asubcomplaint
>THIS.Requery
>THIS.Refresh
>
>IF USED('lookup')
>	USE IN lookup
>ENDIF
>
>
>Am I doing these lookups at the right time? How come the code works sometimes, but not all the time. Do I even need the code in the When Event of the Sub-complaint combobox? Thanks for a clue.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform