Access VBA DCount() on SQL 2008 server table
Posted on 2010-01-11
I'm having a weird problem when using a DCount() function in Access 2003 VBA.
I'm trying to use a DCount() to check whether there are related records in a table but for dates > 01/01/2010 DCount() function just returns a 0.
For dates <= 01/01/2010 it works fine.
I'm using MS Access 2003 SP3 with a linked table to a SQL Server 2008 Express
The data type in SQL server is dateTime
I've also created a test table with just a few dates in 2009 and a few in 2010 and DCount() exhibits exactly the same behaviour.
Just to confirm that I'm using the correct syntext my VBA code is;
MsgBox DCount("[TestDate]", "dbo_tbltest", "[TestDate] = #02/01/2010#")
Can anyone else confirm this or offer some suggestions?
Thanks for looking