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  

Sorting a query is bringing up a parameter request for some fields



 
 
Thread Tools Display Modes
  #1  
Old May 30th, 2004, 02:16 AM
Donna
external usenet poster
 
Posts: n/a
Default Sorting a query is bringing up a parameter request for some fields

I have created a qry that uses a few fields created by IIF statements. When I run the query it prompts me only for the paramater of [enter year] that I put in it. But as soon as I add a sort on one of the fields (not the IIF statement fields), it immediately asks me for a parameter value for 2 of my 4 IIF statement fields. Is there any way I can keep that from happening? This is my IIF statement field: GCRS: (IIf([CRS] Like 5 & "*",[CRS],(IIf([CRS] Like 6 & "*",[CRS])))).

By the way, this is the only way I could figure out how to do an IIF statement asking for "If CRS begins with a 5 or a 6 then give me the CRS number, else leave it blank. Do you have a better way to do this also?
  #2  
Old May 30th, 2004, 03:51 AM
tina
external usenet poster
 
Posts: n/a
Default Sorting a query is bringing up a parameter request for some fields

for the IIf() function, how about:

GCRS: IIf(Left([CRS], 1) In(5, 6), [CRS], Null)

if that doesn't work, try

GCRS: IIf(Left([CRS], 1) = 5 Or Left([CRS], 1) = 6, [CRS], Null)

hth


"Donna" wrote in message
...
I have created a qry that uses a few fields created by IIF statements.

When I run the query it prompts me only for the paramater of [enter year]
that I put in it. But as soon as I add a sort on one of the fields (not the
IIF statement fields), it immediately asks me for a parameter value for 2 of
my 4 IIF statement fields. Is there any way I can keep that from happening?
This is my IIF statement field: GCRS: (IIf([CRS] Like 5 &
"*",[CRS],(IIf([CRS] Like 6 & "*",[CRS])))).

By the way, this is the only way I could figure out how to do an IIF

statement asking for "If CRS begins with a 5 or a 6 then give me the CRS
number, else leave it blank. Do you have a better way to do this also?


  #3  
Old May 30th, 2004, 08:31 PM
John Spencer (MVP)
external usenet poster
 
Posts: n/a
Default Sorting a query is bringing up a parameter request for some fields

What version of Access?
What does the SQL statement that fails look like?
Which parameters are you prompted for?

Donna wrote:

I have created a qry that uses a few fields created by IIF statements. When I run the query it prompts me only for the paramater of [enter year] that I put in it. But as soon as I add a sort on one of the fields (not the IIF statement fields), it immediately asks me for a parameter value for 2 of my 4 IIF statement fields. Is there any way I can keep that from happening? This is my IIF statement field: GCRS: (IIf([CRS] Like 5 & "*",[CRS],(IIf([CRS] Like 6 & "*",[CRS])))).

By the way, this is the only way I could figure out how to do an IIF statement asking for "If CRS begins with a 5 or a 6 then give me the CRS number, else leave it blank. Do you have a better way to do this also?

  #4  
Old May 31st, 2004, 07:51 AM
John Vinson
external usenet poster
 
Posts: n/a
Default Sorting a query is bringing up a parameter request for some fields

On Sat, 29 May 2004 18:16:02 -0700, "Donna"
wrote:

By the way, this is the only way I could figure out how to do an IIF statement asking for "If CRS begins with a 5 or a 6 then give me the CRS number, else leave it blank. Do you have a better way to do this also?


How about

IIF([CRS] LIKE "[56]*", [CRS], Null)


John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
 




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 06:28 AM.


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