471,873 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

DCount syntax error when using WHERE...IN

2
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 1239
Rabbit
12,516 Expert Mod 8TB
You don't need the where when using dcount.
May 10 '15 #2
muse79
2
What a silly mistake, thank you! Sometimes you can't see the wood for the trees!
May 10 '15 #3
NeoPa
32,468 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
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.