cs_JeffC1977
Messages postés928Date d'inscriptionvendredi 10 novembre 2000StatutMembreDernière intervention23 septembre 2023
-
12 août 2005 à 14:46
Doro81079
Messages postés380Date d'inscriptionvendredi 22 avril 2005StatutMembreDernière intervention24 février 2015
-
12 août 2005 à 19:02
Salut....
J'ai un problème avec mon update....
Mon programme est utilisé pour faire le suivi des dossier...
Si par exmeple le dossier se retourve au dessinateur, on coche optButton Dessin, si par contre le dossier est transférer au calcultauer on coche optbutton Calcul etc...
Quand j'ouvre le programme, le premier dossier de la Base de Données est visible (c'est le dossier 37904) et j'ai l'enssemble de l'information qui est affiché... Jusqu'ici ca fonctionne tres bien. Si je modifie ce dossier (je change d'OPTButton) et que j'appuis sur le bouton commandButton cmdModifier, ca marche... Les modification sont enregistrées. Toutefois si je fais une recherche (par exemple je recherche le dossier 37905(en utilissant un cmdrecherche et un txtRechercheNormal)). Je verrai apparaitre l'information. Je verrai que le Dossier se trouve au Calcul. Si je modifie le optButton et que je le met au Dessin (Op4(optButton)) et que j'apuis sur le cmdModifier (le bouton pour faire le update), ca marche. Les info sont "sauvé et tout ce qui doit être modifié à été changé.
Cependant si je recherche un dossier (par exmeple le dossier 37904) et que je reviens au dossier 37905 (en faisant une autre recherche) et bine je me rend compte que le uptdate n'a pas fonctionner, Le optButton est encore au Calcul.
Pourquoi mon update fonctionne au premier dossier (dossier lors de l'ouverture du programme) et que ca ne fonctionne pas pour les autres dossier ?????
Voici l'intégrale de mon code et merci d'avance
Private Sub cmdmodifier_Click()
On Error Resume Next
If Op1.Value = True Then
txtRecherche.Text = "X"
Else
txtRecherche.Text = ""
End If
If Op2.Value = True Then
txtAttenteTerrain.Text = "X"
Else
txtAttenteTerrain.Text = ""
End If
If Op3.Value = True Then
txtCalcul.Text = "X"
Else
txtCalcul.Text = ""
End If
If Op4.Value = True Then
txtDessin.Text = "X"
Else
txtDessin.Text = ""
End If
If Op5.Value = True Then
txtRapport.Text = "X"
Else
txtRapport.Text = ""
End If
If Op6.Value = True Then
txtYvon.Text = "X"
Else
txtYvon.Text = ""
End If
If Op7.Value = True Then
txtAttenteTirroir.Text = "X"
Else
txtAttenteTirroir.Text = ""
End If
If Op8.Value = True Then
txtBureauPascal.Text = "X"
Else
txtBureauPascal.Text = ""
End If
Private Sub Timer1_Timer()
lblTimer.Caption = ""
End Sub
Private Sub Form_Activate()
Set txtDossier.DataSource = BD
txtDossier.DataField = "DOSSIER"
Set txtLivraison.DataSource = BD
txtLivraison.DataField = "LIVRAISON"
Set txtTravail.DataSource = BD
txtTravail.DataField = "TRAVAIL"
Set txtRecherche.DataSource = BD
txtRecherche.DataField = "RECHERCHE"
Set txtRechercheActif.DataSource = BD
txtRechercheActif.DataField = "RECHERCHEACTIF"
Set txtAttenteTerrain.DataSource = BD
txtAttenteTerrain.DataField = "ATTENTE_TERRAIN"
Set txtAttenteTerrainActif.DataSource = BD
txtAttenteTerrainActif.DataField = "ATTENTE_TERRAINACTIF"
Set txtCalcul.DataSource = BD
txtCalcul.DataField = "CALCUL"
Set txtCalculActif.DataSource = BD
txtCalculActif.DataField = "CALCULACTIF"
Set txtDessin.DataSource = BD
txtDessin.DataField = "DESSIN"
Set txtDessinActif.DataSource = BD
txtDessinActif.DataField = "DESSINACTIF"
Set txtRapport.DataSource = BD
txtRapport.DataField = "RAPPORT"
Set txtRapportActif.DataSource = BD
txtRapportActif.DataField = "RAPPORTACTIF"
Set txtYvon.DataSource = BD
txtYvon.DataField = "YVON"
Set txtYvonActif.DataSource = BD
txtYvonActif.DataField = "YVONACTIF"
Set txtAttenteTirroir.DataSource = BD
txtAttenteTirroir.DataField = "ATTENTE_TIRROIR"
Set txtAttenteTirroirActif.DataSource = BD
txtAttenteTirroirActif.DataField = "ATTENTE_TIRROIRACTIF"
Set txtBureauPascal.DataSource = BD
txtBureauPascal.DataField = "PASCAL"
Set txtReference.DataSource = BD
txtReference.DataField = "RÉFÉRENCE"
Set txtRemarque.DataSource = BD
txtRemarque.DataField = "REMARQUE"
End Sub
Private Sub Form_Load()
On Error Resume Next
connection.Provider = "Microsoft.jet.OLEDB.4.0"
'Chemin de la base de donnée (APP.PATH permet de ce mettre dans le chemin
'courant la ou ce trouve le projet)- Paramettrage de la chaine de connection
connection.ConnectionString = App.Path & "\dossier_actif.mdb"
'Ouverture de la connection
connection.Open
'Set BD = New ADODB.Recordset
'Ouverture de la requête sql dans le recordset
BD.Open "Select * from dossiers_actif", connection, adOpenDynamic, adLockOptimistic
' Pour faire apparaître de l'Info dans le ListView
Init_ListView
optDossier.Value = True
Form_Activate
txtRechercheNormale.SetFocus
End Sub
Private Sub cmdRecherche_Click()
Dim msg1, msg2 As String
If txtRechercheNormale.Text = "" Or IsNull(txtRechercheNormale) Then
msg1 = MsgBox("Vous devez indiquer un Nº de dossier !", vbInformation + vbOKOnly)
txtRechercheNormale.SetFocus
ElseIf optDossier.Value = True Then
Set BD2 = New ADODB.Recordset
BD2.Open "SELECT * FROM [dossiers_actif] WHERE [DOSSIER] like '%" & txtRechercheNormale.Text & "%'", connection, adOpenKeyset, adLockBatchOptimistic
BD2005.Open "SELECT * FROM [TRAVAUX EN COURS 2005] WHERE [DOSSIER] like '%" & txtRechercheNormale.Text & "%'", connection, adOpenKeyset, adLockBatchOptimistic
Else
msg2 = MsgBox("Dossier inéxistant, veuillez saisir un N° de dossier existant !", vbInformation + vbOKOnly)
txtRechercheNormale.SetFocus
End If
ElseIf optReference.Value = True Then
Set BD2 = New ADODB.Recordset
BD2.Open "SELECT * FROM [dossiers_actif] WHERE [RÉFÉRENCE] like '%" & txtRechercheNormale.Text & "%'", connection, adOpenKeyset, adLockBatchOptimistic
Else
msg2 = MsgBox("Dossier inéxistant, veuillez saisir un N° de dossier existant !", vbInformation + vbOKOnly)
txtRechercheNormale.SetFocus
End If
End If
If IsNull(Valeur) Then
IsN = ""
Else
IsN = Valeur
End If
End Function
Private Sub cmd_Ajout_Click()
ajoutDossier.Show
Unload Me
End Sub
Private Sub cmd_Supprimer_Click()
Dim msg1 As String
Supression = MsgBox("Êtes-vous certain de vouloir suprimer ce Dossier?", vbYesNo, "Attention")
If Supression = vbYes Then
'Permet de supprimer l'enregistrement en cour
BD.Delete
BD.MovePrevious
msg1 = MsgBox("Données supprimées !", vbInformation + vbOKOnly)
'S'il n'y a plus d'enregistrement aller au premier
If BD.BOF Then
BD.MoveFirst
End If
End If
End Sub
Private Sub cmd_Precedent_Click()
Call Form_Activate
BD.MovePrevious
'S'il n'y a plus d'enregistrement aller au premier
If BD.BOF Then
BD.MoveFirst
End If
End Sub
Private Sub cmd_Suivant_Click()
Call Form_Activate
'Permet d'aller a l'enregistrement suivant dans la table
BD.MoveNext
'S'il n'y a plus d'enregistrement aller au dernier
If BD.EOF Then
BD.MoveLast
End If
End Sub
Private Sub cmd_Quitter_Click()
'fermeture des tables et de la base
On Error Resume Next
BD.Close
BD2.Close
BD2005.Close
connection.Close
Set BD = Nothing
Set BD2 = Nothing
Set BD2005 = Nothing
'fin du programme
End
End Sub
Private Sub Init_ListView()
'Initialisation de la listview
ListView1.View = lvwReport ' Crer une ligne pour affichier les différents titre des colonnes.
ListView1.ColumnHeaders.Clear
ListView1.ListItems.Clear
ListView1.BackColor = &HE0E0E0
Private Sub txtLivraison_KeyPress(KeyAscii As Integer)
If KeyAscii = 46 Then
KeyAscii = 47
End If
End Sub
'Lorsqu'il y a un changement au textbox le checkbox se modifie
'***************************************************************************
Private Sub txtRecherche_Change()
If txtRecherche.Text <> "" Then
Op1.Value = True
Else
Op1.Value = False
End If
End Sub
Private Sub txtAttenteTerrain_Change()
If txtAttenteTerrain.Text <> "" Then
Op2.Value = True
Else
Op2.Value = False
End If
End Sub
Private Sub txtCalcul_Change()
If txtCalcul.Text <> "" Then
Op3.Value = True
Else
Op3.Value = False
End If
End Sub
Private Sub txtDessin_Change()
If txtDessin.Text <> "" Then
Op4.Value = True
Else
Op4.Value = False
End If
End Sub
Private Sub txtRapport_Change()
If txtRapport.Text <> "" Then
Op5.Value = True
Else
Op5.Value = False
End If
End Sub
Private Sub txtYvon_Change()
If txtYvon.Text <> "" Then
Op6.Value = True
Else
Op6.Value = False
End If
End Sub
Private Sub txtAttenteTirroir_Change()
If txtAttenteTirroir.Text <> "" Then
Op7.Value = True
Else
Op7.Value = False
End If
Private Sub cmdmodifier_Click()
On Error Resume Next
If Op1.Value = True Then
txtRecherche.Text = "X"
Else
txtRecherche.Text = ""
End If
If Op2.Value = True Then
txtAttenteTerrain.Text = "X"
Else
txtAttenteTerrain.Text = ""
End If
If Op3.Value = True Then
txtCalcul.Text = "X"
Else
txtCalcul.Text = ""
End If
If Op4.Value = True Then
txtDessin.Text = "X"
Else
txtDessin.Text = ""
End If
If Op5.Value = True Then
txtRapport.Text = "X"
Else
txtRapport.Text = ""
End If
If Op6.Value = True Then
txtYvon.Text = "X"
Else
txtYvon.Text = ""
End If
If Op7.Value = True Then
txtAttenteTirroir.Text = "X"
Else
txtAttenteTirroir.Text = ""
End If
If Op8.Value = True Then
txtBureauPascal.Text = "X"
Else
txtBureauPascal.Text = ""
End If
Private Sub cmdRecherche_Click()
Dim msg1, msg2 As String
If txtRechercheNormale.Text = "" Or IsNull(txtRechercheNormale) Then
msg1 = MsgBox("Vous devez indiquer un Nº de dossier !", vbInformation + vbOKOnly)
txtRechercheNormale.SetFocus
ElseIf optDossier.Value = True Then
Set BD2 = New ADODB.Recordset
BD2.Open "SELECT * FROM [dossiers_actif] WHERE [DOSSIER] like '%" & txtRechercheNormale.Text & "%'", connection, adOpenKeyset, adLockBatchOptimistic
BD2005.Open "SELECT * FROM [TRAVAUX EN COURS 2005] WHERE [DOSSIER] like '%" & txtRechercheNormale.Text & "%'", connection, adOpenKeyset, adLockBatchOptimistic
Else
msg2 = MsgBox("Dossier inéxistant, veuillez saisir un N° de dossier existant !", vbInformation + vbOKOnly)
txtRechercheNormale.SetFocus
End If