SunQuest
           MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old June 12th, 2004, 12:57 PM
taffy taffy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 18 taffy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 17 sec
Reputation Power: 0
Dcount Criteria Problem

I am using MS Access and I use the following SQL statement and it works properly:
intX = DCount("[cust code]", "qryFindWhatDone", "[comments] like '*' &6/11/2004 &'*' ")

However, If I use
intX = DCount("[cust Code]", "qryFindWhatDone", "[comments] like '*' & DateToCheck & '*' "), I am get the following error:

The expression you entered as a query parameter produced this error:
'The object doesn't contain the Automation object 'DateToCheck."


I want to get total for the amount of records that has a particular date as a part of the information that is stored in the COMMENT field. If I type in the date, it works. However, I want to store the date in a variable and include the variable as a part of the criteria. This is because the date will be stored from a text box on a form.

Can you pleeeeaaassee help me?

Thanks much.

Taffy.

Reply With Quote
  #2  
Old June 14th, 2004, 02:01 PM
access_user access_user is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 13 access_user User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
more info

Is the variable DateToCheck something that you are taking from an input form? Otherwise, how is it being derived??

Reply With Quote
  #3  
Old June 14th, 2004, 05:40 PM
taffy taffy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 18 taffy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 17 sec
Reputation Power: 0
Guys -
I went through and found a way to get around this. Not pretty, but it works. I create a query, link it to a textbox on the form and use a variable to keep changing the date in the text box. I put this in a loop and woops! it works like a charm!

Thanks much, though.

Taffy

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Dcount Criteria Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway