Bonjour,
Ce n'est pas très clair. Peux-tu poster le code ?
Cordialement,
Merci pour ta réponse :-)
Voilà le code:
Public Function NouvelleFactureMe()
Dim rstFact As Recordset, maBD As Database, Rep As String
Dim meF As Form, meCL As Form
Set maBD = CurrentDb
Rep = MsgBox("Est-ce bien une nouvelle facture" & vbLf & vbLf & _
"MECANIQUE" & vbLf & vbLf & _
"que vous voulez créer ?", vbQuestion + vbDefaultButton1 + vbYesNo, "Contrôle type facture")
If Rep = vbNo Then
Exit Function
End If
'-------------------------------------------------------------------
Set rstFact = maBD.OpenRecordset("Facturation", dbOpenDynaset)
With rstFact
If .RecordCount > 0 Then
'DoCmd.OpenForm "FacturesExMeCa"
DoCmd.OpenForm "FacturesExMeCa", acNormal, "", "", acAdd, acNormal
Set meF = Forms![FacturesExMeCa]
meF!Numfact = DMax("numfact", "facturation") + 1
meF![NCL] = Forms!Clients![NCL]
meF![Nom] = Forms!Clients![Nom]
meF!TF = "FME"
meF!NFactLettre = "FME" & meF!Numfact
meF!Cadre48.Visible = False
End If
End With
'--------------------------------------------------------------------
Set maBD = Nothing
Set rstFact = Nothing
Set meF = Nothing
End Function