IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Access Discussion :

Comment récuperer la derniere valeur entrée pour une selection precise


Sujet :

Access

  1. #141
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut
    Une commande pour les trois en même temps, c'est possible ça ?

  2. #142
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Inscrit en
    Juillet 2007
    Messages
    14 630
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 630
    Points : 34 337
    Points
    34 337
    Par défaut
    je n'ai pas dit ca

    je te demande de me copier le code de tes trois boutons dans un seul post du forum

  3. #143
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut
    Aha Oki, je crée un nouveau post sur le Forum avec comme intitulé, boutons Add / Delete / Update ? C'est ça ?

    et je passe ici en résolu

  4. #144
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut Add / delete / update dans une formulaire
    Bonjour,

    J'ai 3 boutons dans un formulaire "FmMvt" Ajout / Modif. / Supp.
    Ajout et Supprime fonctionnent mais il me manque qq ch pour la modification.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    Private Sub BtnAjout_Click()
    Dim RS As New ADODB.Recordset
    Dim strSQL As String
     
    strSQL = "SELECT * FROM TbMvt"
            RS.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
     
     
                RS.Fields("Datesortie") = Me.zdtDatesortie
                RS.Fields("Beneficiaire") = Me.zdlBeneficiaire
                RS.Fields("CompteurA") = Me.zdtCompteurA
                RS.Fields("CompteurD") = Me.zdtCompteurD
                RS.Fields("PompeD") = Me.zdtPompeD
                RS.Fields("PompeA") = Me.zdtPompeA
            RS.Update
            RS.Close
     
    End Sub
     
    Private Sub BtnModif_Click()
    Dim RS As New ADODB.Recordset
    Dim strSQL As String
     
    strSQL = "SELECT * FROM TbMvt"
            RS.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
            RS.Updade
                RS.Fields("Datesortie") = Me.zdtDatesortie
                RS.Fields("Beneficiaire") = Me.zdlBeneficiaire
                RS.Fields("CompteurA") = Me.zdtCompteurA
                RS.Fields("CompteurD") = Me.zdtCompteurD
                RS.Fields("PompeD") = Me.zdtPompeD
                RS.Fields("PompeA") = Me.zdtPompeA
            RS.Update
            RS.Close
            DoCmd.Close acForm, Me.Name
     
    End Sub
     
    Private Sub BtnSupp_Click()
    Dim RS As New ADODB.Recordset
    Dim strSQL As String
    Dim IDMvt As Double
    IDMvt = GetParam("IdMvt")
            strSQL = "SELECT * FROM TbMvt Where IdMVt =" & IDMvt
            RS.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
            RS.Delete
            RS.Close
            DoCmd.Close acForm, Me.Name
     
    End Sub
    Supp. et Modif se ferment au clique :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    DoCmd.Close acForm, Me.Name
    Je souhaiterais que quand on ajoute cela mette à 0 les champs sans fermer le formulaire.

    Merci de votre aide et merci à toi Jean Philippe
    cordialement

  5. #145
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Inscrit en
    Juillet 2007
    Messages
    14 630
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 630
    Points : 34 337
    Points
    34 337
    Par défaut
    donc pas de nouvelle discussion, mais peux-tu stp coller le code des 3 boutons, meme si c'est "la meme chose", que je verifie stp

  6. #146
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut
    J'ai pas compris ce qui c'est passé, ma nouvelle discution se retrouve ici lol
    Oui le code des trois boutons sont au dessus déjà

  7. #147
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Inscrit en
    Juillet 2007
    Messages
    14 630
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 630
    Points : 34 337
    Points
    34 337
    Par défaut
    alors, on change quelques trucs:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    Private Sub BtnAjout_Click()
    Dim RS As New ADODB.Recordset
    Dim strSQL As String
     
    strSQL = "SELECT * FROM TbMvt"
            RS.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
     
     Rs.AddNew 'et oui on ajoute
                RS.Fields("Datesortie") = Me.zdtDatesortie
                RS.Fields("Beneficiaire") = Me.zdlBeneficiaire
                RS.Fields("CompteurA") = Me.zdtCompteurA
                RS.Fields("CompteurD") = Me.zdtCompteurD
                RS.Fields("PompeD") = Me.zdtPompeD
                RS.Fields("PompeA") = Me.zdtPompeA
            RS.Update
            RS.Close
     
    End Sub
     
    Private Sub BtnModif_Click()
    Dim RS As New ADODB.Recordset
    Dim strSQL As String
    Dim IdMvt  as Double
    'on modifie le mouvement en cours
    idMvt = GetParam("Idmvt")
    strSQL = "SELECT * FROM TbMvt WHERE IDMvt=" & IdMvt
            RS.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
     
                RS.Fields("Datesortie") = Me.zdtDatesortie
                RS.Fields("Beneficiaire") = Me.zdlBeneficiaire
                RS.Fields("CompteurA") = Me.zdtCompteurA
                RS.Fields("CompteurD") = Me.zdtCompteurD
                RS.Fields("PompeD") = Me.zdtPompeD
                RS.Fields("PompeA") = Me.zdtPompeA
            RS.Update
            RS.Close
            DoCmd.Close acForm, Me.Name
     
    End Sub
     
    Private Sub BtnSupp_Click()
    Dim RS As New ADODB.Recordset
    Dim strSQL As String
    Dim IDMvt As Double
    'on supprime le mouvement en cours
    IDMvt = GetParam("IdMvt")
            strSQL = "SELECT * FROM TbMvt Where IdMVt =" & IDMvt
            RS.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
            RS.Delete
            RS.Close
            DoCmd.Close acForm, Me.Name
     
    End Sub
    rest'e maintenant à tenir compte de l'impact de la modification sur les compteurs

  8. #148
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut
    rest'e maintenant à tenir compte de l'impact de la modification sur les compteurs
    Mais oui c'est vrai ça !!!!
    Penses tu que cela risque de provoquer des pb ?

    Je viens de voir les modif que tu a apporté, oki je comprends on appel l'IDMvt de la ligne sélectionne, comme pour supprimer, mais on passe le code d'ajout au lieu de la suppression, en fait comme j'avais fait c'est toute la table que j’appelais c'est ça ?

  9. #149
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut
    Jean Philippe,

    Pour le bouton supprimer si je veux passer par un msgbox de confirmation comme je dois m'y prendre ?

  10. #150
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Inscrit en
    Juillet 2007
    Messages
    14 630
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 630
    Points : 34 337
    Points
    34 337
    Par défaut
    Tu peux partir sur une alerte demandant confirmation de l'utilisateur, par exemple
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Msgbox("Etes vous sur de vouloir supprimer?", vbYesNo)

  11. #151
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut
    OK, et si yes comment je lui indique d'effectuer la suppression ?

  12. #152
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Inscrit en
    Juillet 2007
    Messages
    14 630
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 630
    Points : 34 337
    Points
    34 337
    Par défaut
    tu peux faire un test sur le retour du msgbox
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    If Msgbox("Etes vous sur de vouloir supprimer?", vbYesNo)=vbYes Then
    'tu fais ta suppression
    Else
    'tu ne fais rien
    End If

  13. #153
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut
    Oki bizn compris
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    Private Sub BtnSupp_Click()
    If MsgBox("Etes vous sur de vouloir supprimer?", vbYesNo) = vbYes Then
    Dim RS As New ADODB.Recordset
    Dim strSQL As String
    Dim IDMvt As Double
    'on supprime le mouvement en cours
    IDMvt = GetParam("IdMvt")
            strSQL = "SELECT * FROM TbMvt Where IdMVt =" & IDMvt
            RS.Open strSQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
            RS.Delete
            RS.Close
            DoCmd.Close acForm, Me.Name
    Else
    MsgBox("Suppression annulée", vbYesNo)
    End If
    End Sub

  14. #154
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Inscrit en
    Juillet 2007
    Messages
    14 630
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 630
    Points : 34 337
    Points
    34 337
    Par défaut
    à la fin un simple
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    MsgBox("Suppression annulée", vbOkOnly)
    fera l'affaire

  15. #155
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut
    j'ai carrément mis :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    DoCmd.Close acForm, Me.Name
    D'ailleurs pourquoi Me.Name ?? c'est générique ?

    Je vais clôturer le post comme résolu ici, Merci bcp de ton coup de main, c'était génial j'ai plus qu'a faire les champ calculés pour ça je vais ouvrir un autre post

  16. #156
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Inscrit en
    Juillet 2007
    Messages
    14 630
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 630
    Points : 34 337
    Points
    34 337
    Par défaut
    Le second parametre est le nom du formulaire que tu souhaites fermer.
    Des fois que tu changes le nom de formulaire à plusieurs reprises, ca sera transparent avec ce code.
    Si tu utilisais
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Docmd.Close acForm,"Tonnomdeformulaire"
    tu t'exposerais à des plantages en cas de modifications

  17. #157
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut
    arfff j'aimes pas le mot "plantage"
    Et oooh maitre du code il y a t il une solution à cela ?

  18. #158
    Rédacteur/Modérateur

    Avatar de Jean-Philippe André
    Homme Profil pro
    Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Inscrit en
    Juillet 2007
    Messages
    14 630
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Canada

    Informations professionnelles :
    Activité : Architecte Power Platform, ex-Développeur VBA/C#/VB.Net
    Secteur : Finance

    Informations forums :
    Inscription : Juillet 2007
    Messages : 14 630
    Points : 34 337
    Points
    34 337
    Par défaut
    Ben l'erreur relevée serait du type "le formulaire Tonnomdeformulaire que vous essayez de fermer n'existe pas"

  19. #159
    Membre régulier
    Homme Profil pro
    Technico - Administratif
    Inscrit en
    Août 2008
    Messages
    384
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Technico - Administratif
    Secteur : Bâtiment Travaux Publics

    Informations forums :
    Inscription : Août 2008
    Messages : 384
    Points : 107
    Points
    107
    Par défaut
    Ahaaaa oki doki j'ai eu peur, donc je clôture ici

+ Répondre à la discussion
Cette discussion est résolue.
Page 8 sur 8 PremièrePremière ... 45678

Discussions similaires

  1. Réponses: 1
    Dernier message: 21/01/2014, 16h20
  2. Réponses: 5
    Dernier message: 23/05/2008, 15h33
  3. utiliser une valeur float pour une boucle for
    Par didi59650 dans le forum Débuter
    Réponses: 6
    Dernier message: 18/04/2006, 17h32
  4. [Tableaux] Tableau valeur vide pour une clé
    Par hisy dans le forum Langage
    Réponses: 3
    Dernier message: 17/01/2006, 11h49
  5. comment afficher cursor: hand sous FF pour une image?
    Par Death83 dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 08/09/2005, 08h48

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo