Bonjour à tous
Enfin avec votre aide précieux, Je viens de finir avec ma petite application. Comme dernière étape je voudrai distribuer mon application pour une période limitéé et puis le programme va s'arréter en demandant à l'utilisateur d'entrer une clé pour activer le programme. J'ai trouvé ce code dans un forum que j'ai adapté et introduit dans mon application mais il parrait qu'il y'a un probléme car je recois des messages d'erreurs liées à RS.FindFirst et RS.NoMatch (data not found) (type mismatch...)
le code originale:
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
70
Dim DB As Database
Dim RS As Recordset
Private Sub Form_Load()
 
Dim COD As String
Dim Now As Date
Dim s As String
Dim SS As Date
Now = Date
Dim ts As String
'''''''''''''''''''
''''''''''''''''''
 
SS = Format$(DateDiff("d", -30, Now))
'Text3.Text = ts
s = GetSetting("ooo", "oo", "oo", Text1.Text)
Text1.Text = s
'If Not ts = "" Then
'If ts < Now Then
'MsgBox ts
'Unload Me
'End If
'End If
'''''''''''''''''''''''''''''''
If Trim$(Text1.Text) = "" Then
Text1.Text = SS
SaveSetting "ooo", "oo", "oo", SS
SaveSetting "ooo", "oo", "osama", Now
 
 
End If
'
'''''''''''''''''''''''''''
 
COD = GetSetting("OSAMA", "OSAMA", " CODE", Text2.Text)
Text2.Text = CODE
Set DB = OpenDatabase("REGSTED.mdb", False, False, ";pwd=" & "123")
Set RS = DB.OpenRecordset("REG_DATA", 2)
RS.FindFirst "CODE='" + Text2.Text + "'"
If RS.NoMatch Then
 
s = GetSetting("ooo", "oo", "oo", SS)
Text1.Text = s
Else
MsgBox "le programme est enregistré avec succés"
Unload Me
Exit Sub
End If
s = GetSetting("ooo", "oo", "oo", SS)
ts = GetSetting("ooo", "oo", "osama", Text3.Text)
Text3.Text = ts
If ts > Now Then
MsgBox "la période d'éssai est terminée"
 
Unload Me
Exit Sub
End If
Dim regm As String
 
regm = MsgBox("la période d'éssai est terminée, voulez vous enregitrer? vbYesNo)
If regm = vbNo Then
Unload Me
Else
FORM2.Show
Unload Me
End If
Exit Sub
 
 
End If
le code adapté:
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
70
71
72
73
74
Dim DB As ADODB.Connection
Dim RS As ADODB.Recordset
Private Sub Form_Load()
With Me.Adodc1
 .ConnectionString = "F:\logicièl\database.mdb"
 
End With
 
Dim COD As String
Dim Now As Date
Dim s As String
Dim SS As Date
Now = Date
Dim ts As String
'''''''''''''''''''
''''''''''''''''''
 
SS = Format$(DateDiff("d", -30, Now))
'Text3.Text = ts
s = GetSetting("ooo", "oo", "oo", Text1.Text)
Text1.Text = s
'If Not ts = "" Then
'If ts < Now Then
'MsgBox ts
'Unload Me
'End If
'End If
'''''''''''''''''''''''''''''''
If Trim$(Text1.Text) = "" Then
Text1.Text = SS
SaveSetting "ooo", "oo", "oo", SS
SaveSetting "ooo", "oo", "osama", Now
 
 
End If
'
'''''''''''''''''''''''''''
 
COD = GetSetting("OSAMA", "OSAMA", " CODE", Text2.Text)
Text2.Text = CODE
Set DB = OpenDatabase("database.mdb", False, False, ";pwd=" & "abc")
Set RS = DB.OpenRecordset("table3", 2)
RS.FindFirst "CODE='" + Text2.Text + "'"
If RS.NoMatch Then
 
s = GetSetting("ooo", "oo", "oo", SS)
Text1.Text = s
Else
MsgBox "le programme est enregistré avec succés"
Unload Me
Exit Sub
End If
s = GetSetting("ooo", "oo", "oo", SS)
ts = GetSetting("ooo", "oo", "osama", Text3.Text)
Text3.Text = ts
If ts > Now Then
MsgBox "la période d'éssai est terminée"
FORM8.Show
Unload Me
Exit Sub
End If
Dim regm As String
 
regm = MsgBox("la période d'éssai est terminée, voulez vous enregitrer vbYesNo)
If regm = vbNo Then
Unload Me
Else
FORM8.Show
Unload Me
End If
Exit Sub
 
 
End If
Je dois noter que j'ai crée une table avec les méme champs que le modèle que j'ai piqué du forum.
Merci à tous