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 June 1st, 2006, 07:20 AM
Friend of Wrox
 
Join Date: Apr 2006
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts
Default IIf problem

Hi,

I have a little problem using the IIf. What I would like to have is that on a continuous form a count operation is performed.
If for exemple I'm using a 'time' field to count on, what I would like is that it counts the data if the fields value is before 14:00 and return 0 if no record has a time before 14:00. So if I have 3 fields before 14:00 (like 12:10 and 13:25 and 13:59) it has to return 3.

If I would have the fields 12:10 and 13:25 and 13:59 and 14:10 it should return 3. If i would only have 14:10 and 14:55 it has to return 0.

Does anyone knows how I have to do this? Everything I try fails...

thanks

 
Old June 1st, 2006, 11:35 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 142
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can make the continuous form a subform of another, and on that other add a text box. Assuming the record source for the continuous form is a query named 'qry', the data source for the text box should be:

SELECT(COUNT(*) FROM qry WHERE field < #14:00#)

The way the time's formatted may need to be fixed, I've not used time in a query before.






Similar Threads
Thread Thread Starter Forum Replies Last Post
IIf umeshtheone Beginning VB 6 3 June 21st, 2007 12:24 AM
Help with IIF Statment Corey Access 2 December 14th, 2006 11:10 AM
Select iif problem kon SQL Language 2 March 28th, 2006 11:24 PM
IIF Statement golden Access 3 July 12th, 2004 07:49 PM





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