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  

Unable to use filter in datasheet view or add criteria to query indesign view



 
 
Thread Tools Display Modes
  #1  
Old March 3rd, 2010, 04:38 PM posted to microsoft.public.access.queries
HouBMan
external usenet poster
 
Posts: 5
Default Unable to use filter in datasheet view or add criteria to query indesign view

Hello all,

I have a question regarding a custom function. The query results can't
be filtered nor can a criteria be used in the design window to filter/
restrict the records. The function returns the correct answer for all
the cases but I need the functionality to filter the results.

Here is purpose, input and output and example uses:

Purpose:
If given 2 dates, a month and a year, the function returns the number
of days that fall between the start and enddates, in the given month
and year.
Example 1,
My_Function(#1/1/2010#, #1/15/2010#, 1,2010) Returns 14
BTW - 14 is correct because the end date is not considered a full
day; another example:
My_Function(#1/1/2010#, #1/15/2010#, 2, 2010) Returns 0

Input:
StartDate As Date
EndDate As Date
intMonth As Integer
IntYear As Integer
Output:
Integer value

My problem:
The results in the query can't be filtered nor can a criteria be used
in the design window.

Please let me know if you need more detail
  #2  
Old March 3rd, 2010, 05:41 PM posted to microsoft.public.access.queries
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Unable to use filter in datasheet view or add criteria to query in design view

HouBMan wrote:
I have a question regarding a custom function. The query results can't
be filtered nor can a criteria be used in the design window to filter/
restrict the records. The function returns the correct answer for all
the cases but I need the functionality to filter the results.

Here is purpose, input and output and example uses:

Purpose:
If given 2 dates, a month and a year, the function returns the number
of days that fall between the start and enddates, in the given month
and year.
Example 1,
My_Function(#1/1/2010#, #1/15/2010#, 1,2010) Returns 14
BTW - 14 is correct because the end date is not considered a full
day; another example:
My_Function(#1/1/2010#, #1/15/2010#, 2, 2010) Returns 0

Input:
StartDate As Date
EndDate As Date
intMonth As Integer
IntYear As Integer
Output:
Integer value

My problem:
The results in the query can't be filtered nor can a criteria be used
in the design window.



There is something wrong in the query. Poast back with a
Copy/Paste of the query's SQL view.

--
Marsh
MVP [MS Access]
  #3  
Old March 3rd, 2010, 05:50 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Unable to use filter in datasheet view or add criteria to queryin design view

You should be able to filter based on the results of the function.

SELECT SomeField, My_Function(#1/1/2010#, #1/15/2010#, 1,2010) as TheResult
FROM SomeTable
WHERE My_Function(#1/1/2010#, #1/15/2010#, 1,2010) = 14

What you cannot do is the following:
SELECT SomeField, My_Function(#1/1/2010#, #1/15/2010#, 1,2010) as TheResult
FROM SomeTable
WHERE TheResult= 14

The latter query does not work because at the time the criteria is applied
"TheResult" column does not yet exist. That is just the way Access (JET) SQL
works.

If this does not explain it for you,
Please copy and post the SQL of your query that does not work. Also please
tell us what error messages you encounter (if any).

(Possibly unneeded instructions follow)
Open the query
Select View:Sql from the Menu
Select all the text
Copy it
Paste it into the message


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

HouBMan wrote:
Hello all,

I have a question regarding a custom function. The query results can't
be filtered nor can a criteria be used in the design window to filter/
restrict the records. The function returns the correct answer for all
the cases but I need the functionality to filter the results.

Here is purpose, input and output and example uses:

Purpose:
If given 2 dates, a month and a year, the function returns the number
of days that fall between the start and enddates, in the given month
and year.
Example 1,
My_Function(#1/1/2010#, #1/15/2010#, 1,2010) Returns 14
BTW - 14 is correct because the end date is not considered a full
day; another example:
My_Function(#1/1/2010#, #1/15/2010#, 2, 2010) Returns 0

Input:
StartDate As Date
EndDate As Date
intMonth As Integer
IntYear As Integer
Output:
Integer value

My problem:
The results in the query can't be filtered nor can a criteria be used
in the design window.

Please let me know if you need more detail

 




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


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