The problem is that because you've put [txtVendorID] inside the quotes.
Try:
num6 = DSum("[Montant]", "account", "[VendorId] = " & [txtVendorID])
assuming VendorId is numeric, or
num6 = DSum("[Montant]", "account", "[VendorId] = " & Chr(34) &
[txtVendorID] & Chr(34))
if it's text.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)
"Alain" <(E-Mail Removed)> wrote in message
news:2d58e01c469b9$65a73660$(E-Mail Removed)...
> Hi to all, I am getting the following error that I do not
> quite understand error 2471 "Tho object doesn't contain
> the automation object [txtVendorID
>
> this is the code I am using
> num6 = DSum("[Montant]", "account", "[VendorId] =
> [txtVendorID]")
> Forms![MPD Corrector]![txtTotVendorID] = num6
> I have checked my refewrences and the OLE Automation is
> checked, Microsoft ActiveX Data Objects Library 2.7 is
> also checked.
>
> Can anyone tell me what I am doing weong
>
> Many thanks in advance
>
> Alain