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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Getting a report to ignore parameters



 
 
Thread Tools Display Modes
  #1  
Old March 6th, 2005, 05:51 PM
Martin Watts
external usenet poster
 
Posts: n/a
Default Getting a report to ignore parameters

I have a database holding details of students and training courses. One of
the reports produces stats for selected years and selected category of
courses, the year and category being set as parameters in the underlying
query. The parameters are selected by the user from a combo box on a form.
What I would like to do is give the user the option of selecting 'All
Categories' in the combo box and the report therefore, effectively ignore
this parameter, i.e. produce a report for a selected year but showing stats
for all categories of course. How would I do it?

TIA

Martin Watts


  #2  
Old March 6th, 2005, 08:05 PM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

Assuming that your query has a parameter similar to this:

Forms!FormName!ComboBoxName


Just replace it with this (assuming that the combo box is blank when you
want all records):

Forms!FormName!ComboBoxName Or Forms!FormName!ComboBoxName Is Null


--

Ken Snell
MS ACCESS MVP

"Martin Watts" wrote in message
...
I have a database holding details of students and training courses. One of
the reports produces stats for selected years and selected category of
courses, the year and category being set as parameters in the underlying
query. The parameters are selected by the user from a combo box on a
form.
What I would like to do is give the user the option of selecting 'All
Categories' in the combo box and the report therefore, effectively ignore
this parameter, i.e. produce a report for a selected year but showing
stats
for all categories of course. How would I do it?

TIA

Martin Watts




  #3  
Old March 6th, 2005, 09:21 PM
Martin Watts
external usenet poster
 
Posts: n/a
Default


Excellent. Thanks for that Ken, works like a dream.

Martin Watts

"Ken Snell [MVP]" wrote in message

Assuming that your query has a parameter similar to this:

Forms!FormName!ComboBoxName


Just replace it with this (assuming that the combo box is blank when you
want all records):

Forms!FormName!ComboBoxName Or Forms!FormName!ComboBoxName Is Null

"Martin Watts" wrote in message
...
I have a database holding details of students and training courses. One

of
the reports produces stats for selected years and selected category of
courses, the year and category being set as parameters in the underlying
query. The parameters are selected by the user from a combo box on a
form.
What I would like to do is give the user the option of selecting 'All
Categories' in the combo box and the report therefore, effectively

ignore
this parameter, i.e. produce a report for a selected year but showing
stats
for all categories of course. How would I do it?

TIA

Martin Watts



  #4  
Old March 6th, 2005, 09:27 PM
Duane Hookom
external usenet poster
 
Posts: n/a
Default

The method that I prefer is to not set the criteria in the query. Write code
that builds a Where clause to use in the DoCmd.OpenReport method:

Dim strWhere as String
strWhere = "1 = 1 "
If Not IsNull(Me.cboCategories) Then
'assuming the field is a text field
strWhere = strWhere & " AND [CategoryField] = """ & me.cboCategories
& """"
'if categoryField is numeric then uncomment the next line
'strWhere = strWhere & " AND [CategoryField] = " & me.cboCategories
End If
DoCmd.OpenReport "rptYourReport", acPreview, , strWhere
--
Duane Hookom
MS Access MVP


"Ken Snell [MVP]" wrote in message
...
Assuming that your query has a parameter similar to this:

Forms!FormName!ComboBoxName


Just replace it with this (assuming that the combo box is blank when you
want all records):

Forms!FormName!ComboBoxName Or Forms!FormName!ComboBoxName Is Null


--

Ken Snell
MS ACCESS MVP

"Martin Watts" wrote in message
...
I have a database holding details of students and training courses. One
of
the reports produces stats for selected years and selected category of
courses, the year and category being set as parameters in the underlying
query. The parameters are selected by the user from a combo box on a
form.
What I would like to do is give the user the option of selecting 'All
Categories' in the combo box and the report therefore, effectively ignore
this parameter, i.e. produce a report for a selected year but showing
stats
for all categories of course. How would I do it?

TIA

Martin Watts






 




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
Passing query parameters in to a Report johnb Running & Setting Up Queries 1 January 10th, 2005 03:58 PM
show parameters passed from vb app on access report ranimath Setting Up & Running Reports 3 October 29th, 2004 03:35 AM
Display query parameters on report Little pete Setting Up & Running Reports 4 October 1st, 2004 02:01 PM
Display Parameter from Form on Report sara Setting Up & Running Reports 10 July 19th, 2004 04:54 PM


All times are GMT +1. The time now is 08:07 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.