Requête et vb

Résolu
fabricioliking Messages postés 79 Date d'inscription mercredi 30 août 2006 Statut Membre Dernière intervention 15 mai 2009 - 1 mai 2008 à 15:50
fabricioliking Messages postés 79 Date d'inscription mercredi 30 août 2006 Statut Membre Dernière intervention 15 mai 2009 - 1 mai 2008 à 16:15
Voila je cherche à renvoyer tous les résultats de ma requetes dans une autre tables qui me servira de tempon dans mon projet. Cependant j'ai un petite erreur qui me turlupine " cette opération n'est pas autorisée si l'objet est fermé. "
Pourtant ma requête est bien ouverte ...
J'ai mis la ligne ciblé par le débogueur en rouge
 Rst.Open "SELECT EnOfMAO.NUMEROOF, EnopeMAO.CODEAFFEC, EnOfMAO.COMPLAN, EnOfMAO.DELAIMAJ, EnOfMAO.TEMPSPREV, EnopeMAO.NUMEROPE, EnopeMAO.LIBELOPE, EnopeMAO.TUNIPREVU, EnappgamMAO.ARTICLE, EnappgamMAO.LIBAPPORT, EnappgamMAO.BESOIN, EnappgamMAO.UNITSTOK From EnOfMAO, EnopeMAO, EnappgamMAO Where EnOfMAO.NUMEROOF EnopeMAO.NUMEROOF And EnopeMAO.NUMEROPE EnappgamMAO.NUMEROPE;", Cxn, , adLockOptimistic

 
Db_VGP.Execute ("Create table EditStatCde (NUMEROOF varchar(50), CODEAFFEC varchar(50), COMPLAN varchar(50), DELAIMAJ varchar(50), TEMPSPREV varchar(50), NUMEROPE varchar(50), LIBELOPE varchar(50), TUNIPREVU varchar(50), ARTICLE varchar(50), LIBAPPORT varchar(50), BESOIN varchar(50), UNITSTOK varchar(50));")

If Rst.RecordCount <> 0 Then
   
    Rst.MoveFirst
   
    While Not (Rst.EOF)
    Rst.Close
    Wend
   
    Set Rst = Nothing
    Db_VGP.Close
    Set Db_VGP = Nothing
End If

Fabrice,

4 réponses

cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
1 mai 2008 à 15:54
Salut,

Ce n'est pas ta requête qui est fermée mais ta connection : Cxn, regrade bien que tu soit bien connecté à ta base...du moins que ta connection soit active/ouverte...

A+
Exploreur

 Linux a un noyau, Windows un pépin
3
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
1 mai 2008 à 15:59
Décidement....avant ta requête fait :

Msgbox Cnx.State
si le résultat 1 la connection est ouverte, si 0 Fermée

A+
Exploreur

 Linux a un noyau, Windows un pépin
3
cs_Exploreur Messages postés 4821 Date d'inscription lundi 11 novembre 2002 Statut Membre Dernière intervention 15 novembre 2016 15
1 mai 2008 à 15:56
puis fait attention dans ta boucle While...le p'tit rst.Close qui se balade.... tu risques d'avoir des surprises...

A+
Exploreur

 Linux a un noyau, Windows un pépin
0
fabricioliking Messages postés 79 Date d'inscription mercredi 30 août 2006 Statut Membre Dernière intervention 15 mai 2009
1 mai 2008 à 16:15
Ok super c'était bien la connection, merci exploreur

Fabrice,
0
Rejoignez-nous