Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 6th, 2007, 06:22 AM
Registered User
 
Join Date: Sep 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Aprile
Default Help with DCode

Hi, everyone. I´m fairly new to Access and I need help with some code for DCount. I have a form named FormAnalystsEval with text boxes named AJDNumPending, TxtBeginDate and TxtEndDate. The user enters a start date in TxtBeginDate and an end date in TxtEndDate to specify a date range. I want to have a button that if you press it, it will give me the number of records from QueryAllPendingCases where the Partner name is AJ Dallas and the date falls between the two values on the FormAnalystsEval form. Can someone please help me?

Here´s the code I have:

AJDNumPending.Value = DCount("[Case_Number]", "QueryAllPendingCases", "[Partner] = ´AJ Dallas´ AND Between [Forms]![FormAnalystsEval]![TxtBeginDate] And [Forms]![FormAnalystsEval]![TxtEndDate]")


Thanks in advance.

Aprile
www.accessdatabaserepair.com - Access Repair Tool
 
Old September 6th, 2007, 08:07 AM
Registered User
 
Join Date: Sep 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You mean, dcount? Try this one:

Code:
DCount("*", "[QueryAllPendingCases]", "[Partner] = 'AJ Dallas' AND [CaseDateFieldName] Between #" & Format([Forms]![FormAnalystsEval]![TxtBeginDate],"yyyy/mm/dd") & "# And #" & Format([Forms]![FormAnalystsEval]![TxtEndDate],"yyyy/mm/dd") & "#")
You need to keep the form dates as values.

HTH,


Hailey
www.msaccessrepair.com - Access Recovery









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.