| View previous topic :: View next topic |
| Author |
Message |
JimNH14 General User

Joined: 12 Dec 2011 Posts: 8 Location: UK
|
Posted: Sun May 13, 2012 9:15 am Post subject: SOLVED Query SQL code: calling for a parameter input |
|
|
I need to set up a query so that when it is run the user is asked for the value of a parameter - for example an ID number which is held in the relevant table, then run the query with that variable specified.
The excellent Base Tutorial by Mariano Casanova suggests eg:
WHERE "ID"=:ID number
but this does not seem to work
How is it done?
Last edited by JimNH14 on Sun May 13, 2012 2:09 pm; edited 1 time in total |
|
| Back to top |
|
 |
Sliderule Super User


Joined: 29 May 2004 Posts: 2473 Location: 3rd Rock From The Sun
|
Posted: Sun May 13, 2012 9:27 am Post subject: |
|
|
When using a prompt query ( also referred to as a Parameter Query ), so the user is asked to enter a value, or, values . . . the prompt starts with a colon ( : ) and, must be one word ( no spaces ).
Therefore, I like to use an underscore ( _ ) to simulate a space in the display. This makes it easier for the user to understand.
In your example, change it to. either of the following ( your choice ) :
| Code: | WHERE "ID" = :ID_number
WHERE "ID" = :Enter_ID_number |
I hope this helps, please be sure to let me / us know.
Sliderule
Thanks to add [Solved] in your first post Title ( edit button ) if your issue has been fixed / resolved. |
|
| Back to top |
|
 |
JimNH14 General User

Joined: 12 Dec 2011 Posts: 8 Location: UK
|
Posted: Sun May 13, 2012 11:07 am Post subject: |
|
|
Thanks for this - I have tried it and it no longer rejects the code or gives error messages but there is no dialogue box and the output has headings but no data.
 |
|
| Back to top |
|
 |
JimNH14 General User

Joined: 12 Dec 2011 Posts: 8 Location: UK
|
Posted: Sun May 13, 2012 12:35 pm Post subject: Query SQL code: calling for a parameter input |
|
|
Thanks for this - I have tried it and it no longer rejects the code or gives error messages but there is no dialogue box and the output has headings but no data.
This is in response to Sliderule's suggestion below:
When using a prompt query ( also referred to as a Parameter Query ), so the user is asked to enter a value, or, values . . . the prompt starts with a colon ( : ) and, must be one word ( no spaces ).
Therefore, I like to use an underscore ( _ ) to simulate a space in the display. This makes it easier for the user to understand.
In your example, change it to. either of the following ( your choice ) :
Code:
WHERE "ID" = :ID_number
WHERE "ID" = :Enter_ID_number
I hope this helps, please be sure to let me / us know.
Sliderule |
|
| Back to top |
|
 |
|