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  dBforums > PC based Database Applications > Microsoft Access > prompt in query help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-01-10, 02:56
GeorgeCC GeorgeCC is offline
Registered User
 
Join Date: Sep 2010
Posts: 8
prompt in query help

Hi there,

I have the following prompt in my query:
[Enter City to visit, New York Or Boston:]
So the user selects the city they are after.

Is there a way to adjust this prompt so if the user leaves it blank it will populate the query/report with both cities, i.e Boston and New York?

thanks

George
Reply With Quote
  #2 (permalink)  
Old 09-01-10, 08:29
MikeTheBike MikeTheBike is offline
Registered User
 
Join Date: Apr 2004
Location: Derbyshire, UK
Posts: 714
Quote:
Originally Posted by GeorgeCC View Post
Hi there,

I have the following prompt in my query:
[Enter City to visit, New York Or Boston:]
So the user selects the city they are after.

Is there a way to adjust this prompt so if the user leaves it blank it will populate the query/report with both cities, i.e Boston and New York?

thanks

George
Hi

You could try something like this
Code:
IIf(IsNull([Enter City to visit, New York Or Boston:]),"New York",[Enter City to visit, New York Or Boston:]) Or IIf(IsNull([Enter City to visit, New York Or Boston:]),"Boston",[Enter City to visit, New York Or Boston:])
It is not clear if there are more that the two Cities available in the DB, if so, then this should do what you indicated.

If there are more than two, and you want them all retuning if the request is left blank, then use this
Code:
Like IIf(IsNull([Enter City to visit, New York Or Boston:]),"*",[Enter City to visit, New York Or Boston:]) Or IIf(IsNull([Enter City to visit, New York Or Boston:]),"*",[Enter City to visit, New York Or Boston:])

MTB
Reply With Quote
  #3 (permalink)  
Old 09-01-10, 09:12
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
far better to ditch the prompt altogether in my books
offer the user the choice in say a list box and then write the query on the fly.
doing it thsi way is prone to problems, ferisntace if some bright spark demands that you should add, say Los Angles.. or whatever. each change requires a change by you in the code, whereas the onus for that change, the management of that change should be on the user.. they merely add the new city to the relevant table and jobsagoodun.

its called ownership of the system, its 'thier' system let them make the configuration choices and do the day to day system config management
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On