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
| Function Ajout_Article() As Boolean
Dim RstEan As Recordset, crit_ean As String
Set db = CurrentDb
If cod_int <> "" Then
If Not IsNumeric(cod_int) Then
Call MsgBox("Vous ne pouvez saisir que des codes barres ou des codes articles dans cette zone!", vbExclamation)
MsgBox "ajout article"
Let cod_int = ""
Let Ajout_Article = False
Else
Set RstEan = db.OpenRecordset("SELECT EAN_INT.cod_int, EAN_INT.cod_ean, " & _
"ARTICLES.lib_int, ARTICLES.cod_tva, ARTICLES.lib_nbe, ARTICLES.pri_vte_ht " & _
"FROM EAN_INT INNER JOIN ARTICLES ON EAN_INT.cod_int = ARTICLES.cod_int")
If cod_int >= 10000000 Then
crit_ean = " [cod_ean] = " & cod_int
Else
crit_ean = " [cod_int] = '" & cod_int & "'"
End If
RstEan.FindFirst crit_ean
If RstEan.NoMatch Then
Let Ajout_Article = False
Else
If cod_int >= 10000000 Then
Let cod_int = RstEan!cod_int
End If
Let lib_int = RstEan!lib_int
Let pri_vte_ht = RstEan!pri_vte_ht
Let Ajout_Article = True
End If
RstEan.Close
End If
Else
Call MsgBox("Vous devez saisir un code barres ou un code article dans cette zone!", vbExclamation, "Article inconnu!")
cod_int.SetFocus
Let Ajout_Article = False
End If
'VERIFICATION D ECO CONTRIBUTION ATH
Dim eco As Recordset
code_article = cod_int
Set eco = db.OpenRecordset("SELECT count(*) as nb FROM PLA_ARTLIE WHERE pla_artlie.int_art=" & code_article & " ")
If eco!nb >= 1 Then
On Error GoTo Err_cmdSuivant_Click
DoCmd.GoToRecord , , acNext
eco_contribution
Err_cmdSuivant_Click:
DoCmd.GoToRecord , , acNext
eco_contribution
Else
coef = 0
End If
End Function |
Partager