Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with DCount (Newbie) 1

Status
Not open for further replies.

firebirdta84

Technical User
Aug 23, 2007
56
0
0
US
Hi all,

I'm fairly new to access and need a little help with some code for DCount. I have a form named frm_Analysts_Eval with text boxes named JDoe_Num_Pending, txtStartDate and txtEndDate. The user enters a start date in txtStartDate and an end date in txtEndDate to specify a date range. I want to have a button where, if pressed, it will give me the number of records from qry_All_Pending_Cases where the Partner name is John Doe and the date falls between the two values on the frm_Analysts_Eval form. Can someone please help me? Here's the code I have:

Me.JDoe_Num_Pending.Value = DCount("[Case_Number]", "[qry_All_Pending_Cases]", "[Partner] = 'John Doe' AND Between [Forms]![frm_Analysts_Eval]![txtStartDate] And [Forms]![frm_Analysts_Eval]![txtEndDate]")

Thanks,
Joe
 
You need to keep the form dates as values:

[tt]DCount("*", "[qry_All_Pending_Cases]", "[Partner] = 'John Doe' AND [CaseDateFieldName] Between #" & Format([Forms]![frm_Analysts_Eval]![txtStartDate],"yyyy/mm/dd") & "# And #" & Format([Forms]![frm_Analysts_Eval]![txtEndDate],"yyyy/mm/dd") & "#")[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top