Can't quite figure this one out. This code works fine in Access and VBA. However, in designing a SQL Server 7 application with a Access Project frontend, the code errors and I can't seem to figure this out.

This code retrives a sepecific record from a list box and opens that
record for the user. It errors on the DCount line. Any help is
appreciated. For some reason, SQL doesn't seem to like this.

stLinkCriteria = "[Case NO]=" & "'" & Me![List21] & "'"
If DCount("[Case NO]", "[CHP1]", "[Case NO]=Forms![PrintForm]![List21]") > 0 Then
DoCmd.OpenForm stDocName, , , stLinkCriteria

Thanks

Terry