REQUETE MULTI - TABLES

YPMN Messages postés 98 Date d'inscription vendredi 4 juin 2004 Statut Membre Dernière intervention 20 août 2012 - 9 févr. 2006 à 03:26
bouv Messages postés 1411 Date d'inscription mercredi 6 août 2003 Statut Membre Dernière intervention 3 mars 2019 - 9 févr. 2006 à 11:47
SALUTATION !

Pour être clair, j'ai essayé de présenté ici le code qui m'essouffle avec commentaire:

Public Sub ProcOrientation()
'cette procedure se declence à l'evennement lostfocus du combobox COrientation

Dim VReqOr As String

VTrim = COrientation.Text
Set VBDTabOrientation = New ADODB.Connection
Set VTabOrientation = New ADODB.Recordset

VBDTabOrientation.Provider = "microsoft.jet.oledb.4.0"
VBDTabOrientation.ConnectionString = App.Path & "\Baseosk.mdb"
VBDTabOrientation.Open

'La Base des Donées Baseosk.mdb comportant trois tables (Orientation, Voix et Famille), je veux réaliser une REQUETE qui interrogera ce trois tables se servant de lien entre - elles: LE ORIENTATION (clé primaire dans la table Orientation, simple champs dans les tables Voix et Famille)
Je vous prie de me corriger la REQUETE suivante afin d'otenir de résultats escomptés...

VReqOr = "select TABorientation.Orientation,TabVoix.Voix,TabFamille.Famille from (taborientation inner join tabVoix on taborientation.orientation=tabvoix.orientation) inner join tabfamille on taborientation.orientation=tabfamille.orientation where taborientation.orientaion ='" & VTrim & "'"

VTabOrientation.Open VReqOr, VBDTabOrientation, adOpenDynamic, adLockOptimistic

COrientation.Refresh
Do Until VTabOrientation.EOF
COrientation.AddItem VTabOrientation!Orientation
VTabOrientation.MoveNext
Loop
COrientation.Refresh

TexteVoix.text=VTabOrientation!Voix 'TextBox
TexteFamille.text=VtabOrientation!Famille 'TextBox

VTabOrientation.Close
VBDTabOrientation.Close
Set VBDTabOrientation = Nothing
Set VTabOrientation = Nothing

End Sub

S'il vous plait, remettez-moi sur le bon chémin.

3 réponses

bouv Messages postés 1411 Date d'inscription mercredi 6 août 2003 Statut Membre Dernière intervention 3 mars 2019 1
9 févr. 2006 à 09:36
A premiere vu, je ne vois qu'une petite erreur mais surement du à une erreur de recopie du code.

where taborientation.orientaion
Tu as oublié un 't'
where taborientation.orientation

Sinon, dis-en un peu plus :
Quelle ligne plante, quel message...

Ou mail moi un zip: [mailto:bouvetdavid@hotmail.com bouvetdavid@hotmail.com]

Bonne prog
++
0
Stan62970 Messages postés 48 Date d'inscription mercredi 26 mai 2004 Statut Membre Dernière intervention 20 septembre 2006
9 févr. 2006 à 09:41
Salut
essaye ca :

"SELECT TABorientation.Orientation,TabVoix.Voix,TabFamille.Famille FROM
taborientation O, Voix V, Famille F
WHERE O.orientation = V.orientation AND
O.orientation=F.Orientation AND
o.orientation='" & VTrim & "'"

http://ggggunit.free.fr
0
bouv Messages postés 1411 Date d'inscription mercredi 6 août 2003 Statut Membre Dernière intervention 3 mars 2019 1
9 févr. 2006 à 11:47
Oula, je connaissais pas ce type de requette...

Bonne prog
++
0
Rejoignez-nous