DCount Error# message

I have a text box that I am using to run a count on a number of records based on a 30 day date range. The control source is set at below.

=DCount("*","dbo_NonConfData","CaseDate between(Date() -30) and Date()")

Open in new window


When I open the form I receive an Error# in the object or if I make changes, such as placing brackets around [CaseDate] it will show just a zero value

The odd thing is that I have this working on a system running Access 2013. The result displayed on the form is accurate and without error.

My access application's data resides on a sql server. I am using the sql server Native Client 10.0 ODBC driver on the Access 2010 system and on the Access 2013 system I am using the sql server Native Client 11.0 ODBC driver

Can anyone offer a suggestion as to what the difference could be?
Captur1e.JPG
kwoznica732Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
Try with:

=DCount("*","dbo_NonConfData","CaseDate Between DateAdd('d', -30, Date()) And Date()")

/gustav
0
kwoznica732Author Commented:
Thanks for the suggestion Gustav but it did not make a difference. Attached is a screen shot with the function you provided.  This produced a result of 0. I should see a result of 8.
Capture.JPG
0
Gustav BrockCIOCommented:
Why would you expect that?
Perhaps the "date" is not a date but a string? Then:

=DCount("*","dbo_NonConfData","DateValue(CaseDate) Between DateAdd('d', -30, Date()) And Date()")

/gustav
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

kwoznica732Author Commented:
The reason I expect 8 is because when I run access on my local system where I developed the object it comes back as 8. This is also the number of cases between the system date and last 30 days. I will be revisiting this project soon but I think I'm going to just build a computed column in the database to get the result set.
Thanks for your help.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gustav BrockCIOCommented:
You could try using the "SQL Server" driver.

/gustav
0
kwoznica732Author Commented:
I could not find a working solution and therefore removed the field from the application to get around the issue.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.