A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Showing all records when criteria not chosen



 
 
Thread Tools Display Modes
  #1  
Old August 8th, 2004, 03:21 AM
Deb Smith
external usenet poster
 
Posts: n/a
Default Showing all records when criteria not chosen

I have a form with a series of unbound text boxes and combo boxes that are
used to set the query parameters for a report. Once the user chooses the
criteria from the various boxes, the desired report opens in preview mode.

The text boxes used are for capturing beginning and end dates and use a
pop-up for a calender control. In the underlying query for the report I am
using the following statement in the criteria for the date field called
ToDoDate.

Between [Forms]![To Do List Dialog]![BeginningDate1] And [Forms]![To Do List
Dialog]![EndingDate1].

I would like to have it so that If the user does not select a beginning and
end date but chooses the other criteria criteria required that all records
are shown on the report. I am not sure how this is done.In the past I have
used a statement like the following, but I can't get it to work with this
date field.

Like IIf([Forms]![To Do List Dialog]![Occassion] Is Null,"*",[Forms]![To Do
List Dialog]![Occassion] & "*")

I really could use some help. Thanks


  #2  
Old August 8th, 2004, 09:33 PM
Michael Keating
external usenet poster
 
Posts: n/a
Default Showing all records when criteria not chosen

Hi,

It will probably be easiest to apply the date criteria as the Where
Condition of the report, then you can just leave the where condition blank
when the user doesn't set any dates.

In the click event for the button that is used to launch the report, you
would have something like:

If IsNull(Me.StartDate.Value) Or IsNull(Me.EndDate.Value) Then

DoCmd.OpenReport stDocName, acPreview
Else

DoCmd.OpenReport stDocName, acPreview, , _
"ToDoDate Between #" & _
Format(Me.StartDate, "mm/dd/yyyy") & _
"# AND #" & _
Format(Me.EndDate, "mm/dd/yyyy") & "#"

End If

You need to use "#" for literal dates and format it to the American date
system, if not already.

HTH

MFK.


"Deb Smith" wrote in message
...
I have a form with a series of unbound text boxes and combo boxes that are
used to set the query parameters for a report. Once the user chooses the
criteria from the various boxes, the desired report opens in preview mode.

The text boxes used are for capturing beginning and end dates and use a
pop-up for a calender control. In the underlying query for the report I am
using the following statement in the criteria for the date field called
ToDoDate.

Between [Forms]![To Do List Dialog]![BeginningDate1] And [Forms]![To Do

List
Dialog]![EndingDate1].

I would like to have it so that If the user does not select a beginning

and
end date but chooses the other criteria criteria required that all records
are shown on the report. I am not sure how this is done.In the past I have
used a statement like the following, but I can't get it to work with this
date field.

Like IIf([Forms]![To Do List Dialog]![Occassion] Is Null,"*",[Forms]![To

Do
List Dialog]![Occassion] & "*")

I really could use some help. Thanks




 




Thread Tools
Display Modes

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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract/Export records to seperate sheets using criteria Ken Frost General Discussion 1 August 6th, 2004 04:15 PM
Showing all records from subdatasheet Alcide Using Forms 1 July 6th, 2004 08:41 PM
Showing multiple records on one page of a form Design by Sue General Discussion 0 June 17th, 2004 02:20 PM
Extracting records that meet multiple criteria Cindy Worksheet Functions 1 November 27th, 2003 02:37 AM
Which function to use to count the records satisfying two criteria? Max Worksheet Functions 0 November 21st, 2003 07:59 AM


All times are GMT +1. The time now is 08:08 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.