Filtrer via un combo box

limelloyd Messages postés 25 Date d'inscription mercredi 30 juillet 2008 Statut Membre Dernière intervention 17 novembre 2011 - 19 nov. 2010 à 19:33
limelloyd Messages postés 25 Date d'inscription mercredi 30 juillet 2008 Statut Membre Dernière intervention 17 novembre 2011 - 20 nov. 2010 à 17:30
salut,

je veux filtrer les elements d'une table a partir d'un combo, pour les afficher dans ma list qui appartient a une autre table.
j'arrive pas a trouver le code exacte que je doit mettre dans ma le valid de mon combo box.
je cherche meme des idées , car c'est un prbleme algorithmique. Merci

3 réponses

michelatoutfox Messages postés 828 Date d'inscription mardi 5 octobre 2004 Statut Membre Dernière intervention 7 mai 2013 1
20 nov. 2010 à 00:27
Bonjour,

Comment est peuplé ton combo Rowsource et rowsourcetype)? quel est son controlsource?
Quel rapport y a-t-il entre ce combo et le filtre? quelle est la structire de la table à filtrer? est-ce une table locale (un dbf) ou bien des données distantes (sur un serveur SQL ou Aracle ou PostGres...)
que veut dire "ma list appartient à une autre table"? cette formulation n'a aucun sens!
Pourquoi veux-tu mettre le code dans le Valid?

Quelle version de VFP utilises-tu?

En résumé, si tu veux une réponse, essaies d'être plus précis dans tes questions
0
Mike Gagnon Messages postés 381 Date d'inscription vendredi 15 octobre 2004 Statut Membre Dernière intervention 24 octobre 2013 2
20 nov. 2010 à 14:02
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


**************************************************
*-- Form: form1 (c:\zoo62\form1.scx)
*-- ParentClass: form
*-- BaseClass: form
*-- Time Stamp: 11/25/10 08:01:04 AM
*
DEFINE CLASS form1 AS form


Top = 0
Left = 0
Height = 463
Width = 603
DoCreate = .T.
Caption = "Form1"
Name = "Form1"


ADD OBJECT combo1 AS combobox WITH ;
RowSourceType = 3, ;
RowSource = "select cust_id from customer into cursor tmp", ;
Height = 24, ;
Left = 48, ;
Top = 24, ;
Width = 192, ;
Name = "Combo1"


ADD OBJECT txtcompany AS textbox WITH ;
Comment = "", ;
ControlSource = "tmpresult.company", ;
Height = 23, ;
Left = 120, ;
MaxLength = 40, ;
TabIndex = 3, ;
Top = 120, ;
Width = 288, ;
Name = "txtCompany"


ADD OBJECT lblcompany AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Company", ;
Left = 46, ;
Top = 118, ;
Width = 53, ;
TabIndex = 2, ;
Name = "lblCompany"


ADD OBJECT txtcontact AS textbox WITH ;
Comment = "Primary contact for this Customer.", ;
ControlSource = "tmpresult.contact", ;
Height = 23, ;
Left = 120, ;
MaxLength = 30, ;
TabIndex = 5, ;
Top = 168, ;
Width = 219, ;
Name = "txtContact"


ADD OBJECT lblcontact AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Contact", ;
Left = 47, ;
Top = 166, ;
Width = 42, ;
TabIndex = 4, ;
Name = "lblContact"


ADD OBJECT txttitle AS textbox WITH ;
Comment = "", ;
ControlSource = "tmpresult.title", ;
Height = 23, ;
Left = 120, ;
MaxLength = 30, ;
TabIndex = 7, ;
Top = 227, ;
Width = 219, ;
Name = "txtTitle"


ADD OBJECT lbltitle AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Title", ;
Left = 51, ;
Top = 225, ;
Width = 23, ;
TabIndex = 6, ;
Name = "lblTitle"


ADD OBJECT txtaddress AS textbox WITH ;
Comment = "", ;
ControlSource = "tmpresult.address", ;
Height = 23, ;
Left = 120, ;
MaxLength = 60, ;
TabIndex = 9, ;
Top = 294, ;
Width = 428, ;
Name = "txtAddress"


ADD OBJECT lbladdress AS label WITH ;
AutoSize = .T., ;
WordWrap = .T., ;
BackStyle = 0, ;
Caption = "Address", ;
Left = 60, ;
Top = 292, ;
Width = 46, ;
TabIndex = 8, ;
Name = "lblAddress"


PROCEDURE Load
USE home(2)+"\Data\Customer"
select * from customer where .f. into cursor tmpresult
ENDPROC


PROCEDURE combo1.Valid
select * from customer where cust_id = this.Value into cursor tmpresult
thisform.Refresh()
ENDPROC


ENDDEFINE
*
*-- EndDefine: form1
**************************************************


Mike Gagnon
0
limelloyd Messages postés 25 Date d'inscription mercredi 30 juillet 2008 Statut Membre Dernière intervention 17 novembre 2011
20 nov. 2010 à 17:30
Okay Merci Mike je crois que sa devrai m'aider
0
Rejoignez-nous