Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Flakey combobox behavior?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Flakey combobox behavior?
Miscellaneous
Thread ID:
00426857
Message ID:
00426857
Views:
50
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.
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Next
Reply
Map
View

Click here to load this message in the networking platform