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

IHM Discussion :

perte du focus par inputbox


Sujet :

IHM

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Août 2005
    Messages
    525
    Détails du profil
    Informations personnelles :
    Âge : 56
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Secteur : Santé

    Informations forums :
    Inscription : Août 2005
    Messages : 525
    Points : 194
    Points
    194
    Par défaut perte du focus par inputbox
    bonjour

    A partir d'un bouton placé dans un formulaire "F_Prescriptions", Je remplis des sous formulaires (SF_VVC, SF_perfusion) eux mêmes placés placés dans un sous formulaire SF_Traitement. Tout se passe bien sauf si je demande à l'utilisateur des renseignements par un inputbox. Je n'arrive pas à passer à un nouvel enregistrement dans le sous formulaire SF_perfusion. J'ai essayé toutes les syntaxes, tous les focus mais rien à faire

    Ce code fonctionne:
    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
    Private Sub Commande9_Click()
     
         Dim bilan As String
         Dim Poid As Integer
     
        Poid = Forms!F_prescriptions!Poids.Value
     
            If IsNull(Forms!F_prescriptions!SF_Traitement!ID_Prescription) Then
            Forms!F_prescriptions!SF_Traitement!date_prescription = Date
            ControleDate = Forms!F_prescriptions!SF_Traitement!date_prescription
            Forms!F_prescriptions!SF_Traitement!SF_VVC!vvc = "VVC1"
            Forms!F_prescriptions!SF_Traitement!SF_VVC!produit_VVC = "PG5%"
            Forms!F_prescriptions!SF_Traitement!SF_VVC!dose_VVC = "10 ml/h"
            DoCmd.GoToControl "SF_Traitement"
            DoCmd.GoToControl "SF_VVC"
            DoCmd.GoToRecord , , acNewRec
     
            DoCmd.GoToRecord acActiveDataObject, , acNewRec
            Forms!F_prescriptions!SF_Traitement!SF_VVC!vvc = "VVC2"
            Forms!F_prescriptions!SF_Traitement!SF_VVC!produit_VVC = "PG5%"
            Forms!F_prescriptions!SF_Traitement!SF_VVC!dose_VVC = "10 ml/h"
     
     
            'passe au SF perfusion
            '1
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Voie_IV = "IVSE"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Medicament_IV = "UMULINE"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Dose_IV = "Protocole"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Heures_IV = "glycémie < 1.7 g/l"
            DoCmd.GoToControl "SF_traitement"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion.SetFocus
            DoCmd.GoToRecord , , acNewRec
            '2
            If Poid < 70 Then
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Dose_IV = "20 mg"
            Else
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Dose_IV = "40 mg"
            End If
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Heures_IV = "pour bilan entrées / sorties < 500ml"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Voie_IV = "IVL"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Medicament_IV = "LASILIX"
            Forms!F_prescriptions!SF_Traitement.SetFocus
            Forms!F_prescriptions!SF_Traitement!SF_perfusion.SetFocus
            DoCmd.GoToRecord , , acNewRec
     
                 End If
    mais avec l'inputbox ça ne fonctionne plus

    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
    Private Sub Commande9_Click()
     
        Dim bilan As String
        Dim Poid As Integer
     
        Poid = Forms!F_prescriptions!Poids.Value
     
            If IsNull(Forms!F_prescriptions!SF_Traitement!ID_Prescription) Then
            Forms!F_prescriptions!SF_Traitement!date_prescription = Date
            ControleDate = Forms!F_prescriptions!SF_Traitement!date_prescription
            Forms!F_prescriptions!SF_Traitement!SF_VVC!vvc = "VVC1"
            Forms!F_prescriptions!SF_Traitement!SF_VVC!produit_VVC = "PG5%"
            Forms!F_prescriptions!SF_Traitement!SF_VVC!dose_VVC = "10 ml/h"
            DoCmd.GoToControl "SF_Traitement"
            DoCmd.GoToControl "SF_VVC"
            DoCmd.GoToRecord , , acNewRec
     
            DoCmd.GoToRecord acActiveDataObject, , acNewRec
            Forms!F_prescriptions!SF_Traitement!SF_VVC!vvc = "VVC2"
            Forms!F_prescriptions!SF_Traitement!SF_VVC!produit_VVC = "PG5%"
            Forms!F_prescriptions!SF_Traitement!SF_VVC!dose_VVC = "10 ml/h"
     
            'passe au SF perfusion
            '1
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Voie_IV = "IVSE"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Medicament_IV = "UMULINE"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Dose_IV = "Protocole"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Heures_IV = "glycémie < 1.7 g/l"
            DoCmd.GoToControl "SF_traitement"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion.SetFocus
            DoCmd.GoToRecord , , acNewRec
            '2
            If Poid < 70 Then
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Dose_IV = "20 mg"
            Else
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Dose_IV = "40 mg"
            End If
            bilan = InputBox("Précisez quel doit-être le bilan entrées/ sorties pour les prochaines 24h" & Chr(13) & "Exemple:" & Chr(13) & "< 500 ml")
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Heures_IV = "pour bilan entrées / sorties " & bilan
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Voie_IV = "IVL"
            Forms!F_prescriptions!SF_Traitement!SF_perfusion!Medicament_IV = "LASILIX"
            Forms!F_prescriptions!SF_Traitement.SetFocus
            Forms!F_prescriptions!SF_Traitement!SF_perfusion.SetFocus
            DoCmd.GoToRecord , , acNewRec
             End If
    J'ai voulu essayé le recordset.addnew mais je ne suis pas à l'aise avec la syntaxe et j'ai une erreur à chaque tentative.
    Merci pour votre aide

  2. #2
    Membre habitué
    Profil pro
    Inscrit en
    Août 2005
    Messages
    525
    Détails du profil
    Informations personnelles :
    Âge : 56
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Secteur : Santé

    Informations forums :
    Inscription : Août 2005
    Messages : 525
    Points : 194
    Points
    194
    Par défaut
    J'ai fini par trouver une explication mais je ne sais pas si c'est la bonne. En tout cas, pour moi ça marche.
    En fait, l'inputbox fait réèllement perdre le focus, et j'ai l'impression que plus aucun formulaire n'a le focus. Je réussi à redonner le focus en remontant le focus au formulaire principal, puis je passe le focus aux différents sous formulaires. pour éviter de redonner les focus en permanence, j'ai décider de poser toutes les questions aux utilisateurs au début, ce qui fait que je n'ai plus d'inputbox par la suite et le focus reste sur le sous formulaire concerné.

    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
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
     
        Dim Heure_Antibio As String
        Dim H1_Antibio As String
        Dim H2_Antibio As String
        Dim H3_Antibio As String
        Dim Heure_Debut_Traitement As String
        Dim H1_Perfalgan As String
        Dim H2_Perfalgan As String
        Dim H3_perfalgan As String
        Dim H4_Perfalgan As String
        Dim Oligurie As String
        Dim bilan As String
        Dim Titration As String
        Dim Max_Morphine As String
        Dim heparine As String
        Dim Dose_Hep As String
        Dim ReaVVC As String
        Dim dosepreop As String
        Dim produitpreop As String
        Dim ctl As Control
        Dim Poid As Integer
        Dim ControleDate As Date
        Dim allergique As String
        Dim stDocName As String
        Dim stwhere As String
        Dim stLinkCriteria As String
     
     
        Poid = Forms!F_Prescriptions!Poids.Value
        bilan = InputBox("Précisez quel doit-être le bilan entrées/ sorties pour les prochaines 24h" & Chr(13) & "Exemple:" & Chr(13) & "< 500 ml")
        If Msgbox("Ce patient est-il allergique àla penicilline?", vbQuestion + vbYesNo) = vbNo Then
        allergique = "non"
        Heure_Antibio = InputBox("A quelle heure avez-vous fait la première injection d'antibiotique ?" & (Chr(13)) & "Entrez simplement le chiffre." & (Chr(13)) & "Exemple:" & (Chr(13)) & "8 pour 8h, 14 pour 14h ...")
        Else
        allergique = "oui"
        End If
     
            Forms!F_Prescriptions.SetFocus
     
            ' remplissage voie centrale
            '1
            If IsNull(Forms!F_Prescriptions!SF_Traitement!ID_Prescription) Then
            Forms!F_Prescriptions!SF_Traitement!date_prescription = Date
     
            Forms!F_Prescriptions!SF_Traitement!SF_VVC!vvc = "VVC1"
            Forms!F_Prescriptions!SF_Traitement!SF_VVC!produit_VVC = "PG5%"
            Forms!F_Prescriptions!SF_Traitement!SF_VVC!dose_VVC = "10 ml/h"
            Forms!F_Prescriptions!SF_Traitement.SetFocus
            Forms!F_Prescriptions!SF_Traitement!SF_VVC.SetFocus
            DoCmd.GoToRecord , , acNewRec
     
     
            '2
            Forms!F_Prescriptions!SF_Traitement!SF_VVC!vvc = "VVC2"
            Forms!F_Prescriptions!SF_Traitement!SF_VVC!produit_VVC = "PG5%"
            Forms!F_Prescriptions!SF_Traitement!SF_VVC!dose_VVC = "10 ml/h"
            Forms!F_Prescriptions!SF_Traitement.SetFocus
            Forms!F_Prescriptions!SF_Traitement!SF_VVC.SetFocus
            DoCmd.GoToRecord , , acNewRec
     
            'passe au SF perfusion
            '1
            Forms!F_Prescriptions!SF_Traitement!SF_perfusion!Voie_IV = "IVSE"
            Forms!F_Prescriptions!SF_Traitement!SF_perfusion!Medicament_IV = "UMULINE"
            Forms!F_Prescriptions!SF_Traitement!SF_perfusion!Dose_IV = "Protocole"
            Forms!F_Prescriptions!SF_Traitement!SF_perfusion!Heures_IV = "glycémie < 1.7 g/l"
            Forms!F_Prescriptions!SF_Traitement.SetFocus
            Forms!F_Prescriptions!SF_Traitement!SF_perfusion.SetFocus
            DoCmd.GoToRecord , , acNewRec
    Voilà, ça servira peut-être à un autre débutant comme moi. Mais peut-être il y a plus simple.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [C#] Detecter la perte de focus
    Par iowa dans le forum Windows Forms
    Réponses: 10
    Dernier message: 15/03/2006, 14h03
  2. Réponses: 9
    Dernier message: 02/02/2006, 15h46
  3. Comment détecter la perte de focus d'une fenêtre
    Par Leviathan_72 dans le forum Windows
    Réponses: 5
    Dernier message: 31/12/2005, 00h22
  4. excel -> test lors de la perte du focus d'une cellule
    Par greg778 dans le forum Macros et VBA Excel
    Réponses: 24
    Dernier message: 26/09/2005, 17h26
  5. [VB.NET] Perte de focus entre deux form
    Par toniolol dans le forum Windows Forms
    Réponses: 2
    Dernier message: 05/07/2005, 08h00

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