Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combo
Message
From
09/04/2004 09:36:46
 
 
To
08/04/2004 08:30:23
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Re: Combo
Miscellaneous
Thread ID:
00893230
Message ID:
00893526
Views:
28
Hi Jeffrey.

Based off the company, I would like for my users to select from a list only those personnel within that company who they want to runreports for. Can anyone assist?

What you need to do is set up the combos so that the RowSOurce of the Personnel combo is dependent on the selection in the companies combo, something like this. You want to set up the RowSOurce of the personnel combo in the form's init() so that you can be sure that both combos (company and personnel) have already been instantiated:
*** Set up the SQL statement to use as the RowSource for the personnel combo box
*** Select only the items that have a CompanyID equal to the Item selected in the company combo box
lcRowSource = 'SELECT EmployeeName, EmployeeID FROM Personnel '
lcRowSource = lcRowSource + 'WHERE Personnel.CompanyID = ( Thisform.cboCompany.Value ) INTO CURSOR csrPersonnel '
*** Now set up the combo box's properties
WITH Thisform.cboPersonnel
  .BoundColumn = 2
  .BoundTo = .T.
  .RowSourceType = 3
  .RowSource = lcRowSource
  *** Don't forget to repopulate the control's internal list
  .Requery()
  *** Inialize it to display the first item
  .ListIndex = 1
ENDWITH	
Then, in the Valid() of the companies combo, you just requery() the personnel combo.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform