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
| Private Sub Valider_Click()
Dim stDocName As String
Dim stLinkCriteria As String
Dim doublon As Integer
Dim k%
Dim db As DAO.Database
'on vérifie qu'un patient a ete choisi
If IsNull(Me!IdentPatient) Then
MsgBox "Veuillez choisir un numéro de patient", vbExclamation, "Attention"
Exit Sub
End If
Select Case Me.Cadre8.Value
Case 1
Nom_formulaire = "FEdinburgh"
Case 2
Nom_formulaire = "FPDI"
Case 3
Nom_formulaire = "FFagerstrom"
Case 4
Nom_formulaire = "FCTQ"
End Select
Num = Me![IdentPatient]
Set db = Application.CurrentDb
doublon = DCount("*", db.Tabledefs(Nom_formulaire).Name, "[NumSujet]=" & Num)
If doublon = 0 Then
stDocName = Nom_formulaire
stLinkCriteria = "[numSujet]=" & Me![IdentPatient]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms(Nom_formulaire).numSujet = Num
Forms(Nom_formulaire).ident1 = ident_1
Forms(Nom_formulaire).ident2 = ident_2
Forms(Nom_formulaire).ident3 = ident_3
DoCmd.Close acForm, "Recherche"
Else
stDocName = Nom_formulaire
stLinkCriteria = "[numSujet]=" & Me![IdentPatient]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms(Nom_formulaire).ident1 = ident_1
Forms(Nom_formulaire).ident2 = ident_2
Forms(Nom_formulaire).ident3 = ident_3
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "Recherche"
End If
End Sub |
Partager