469,091 Members | 1,154 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,091 developers. It's quick & easy.

DCount syntax error when using WHERE...IN

Access 2013

I'm having trouble with my syntax. I'm getting a Run-time error 3075 missing operator

This is the code that is causing the trouble:

Expand|Select|Wrap|Line Numbers
  1. vCount = DCount("[SalesID]", "[Additional Costs]", "Where [SalesID] IN (" & vSelected & ")")
vSelected is a Variant and contains list of numbers for instance 62,63,64

I want the DCount to count the records with the salesID 62,63,64 and return the number 3 (the number of records)

I want to use vCount in a msgbox which says "you have selected " & vCount & " records."

Thanks in advance!
May 9 '15 #1

✓ answered by Rabbit

You don't need the where when using dcount.

3 1179
12,516 Expert Mod 8TB
You don't need the where when using dcount.
May 10 '15 #2
What a silly mistake, thank you! Sometimes you can't see the wood for the trees!
May 10 '15 #3
32,159 Expert Mod 16PB
As Rabbit says - The Criteria parameter, of DCount() and other Domain Aggregate functions, is the in the same format as the WHERE clause in SQL, BUT doesn't include the text 'WHERE '.
May 10 '15 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Dermot O'Loughlin | last post: by
8 posts views Thread by msnews.microsoft.com | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.