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  

Select Query with Parameter



 
 
Thread Tools Display Modes
  #1  
Old April 15th, 2005, 12:45 AM
Greg Jesky
external usenet poster
 
Posts: n/a
Default Select Query with Parameter

I am doing an arithmetic calculation in the field row of the query "design
view" , I believe this is called a calculated field.

In the Criteria row of design Query I have ".85" (same column).

This works OK and selects the correct records.

However, the criteria often changes for example from ".85" to ".89" and
rather then changing the Criteria manually I would like to be prompted to
enter .85 or .89 or .73 and have it treated as if I had manually typed the
value.

I have reviewed the HELP documentation and can do not see how to get this
done.

Does anyone have a suggestion??

Thank You,
Greg


  #2  
Old April 15th, 2005, 01:02 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default

Try

[Enter Limit Value:]


--
HTH
Van T. Dinh
MVP (Access)




"Greg Jesky" wrote in message
...
I am doing an arithmetic calculation in the field row of the query "design
view" , I believe this is called a calculated field.

In the Criteria row of design Query I have ".85" (same column).

This works OK and selects the correct records.

However, the criteria often changes for example from ".85" to ".89" and
rather then changing the Criteria manually I would like to be prompted to
enter .85 or .89 or .73 and have it treated as if I had manually typed

the
value.

I have reviewed the HELP documentation and can do not see how to get this
done.

Does anyone have a suggestion??

Thank You,
Greg




  #3  
Old April 15th, 2005, 04:49 AM
Greg Jesky
external usenet poster
 
Posts: n/a
Default

Van,
I don't beleive it worked.
I put into the criteria field what you suggested and input .85 when prompted
but selected 0 records.
I put into the criteria column .85 and selected 2 records from the same
test data. I hope I understood your suggestion..
Thank You,
Greg


"Van T. Dinh" wrote in message
...
Try

[Enter Limit Value:]


--
HTH
Van T. Dinh
MVP (Access)




"Greg Jesky" wrote in message
...
I am doing an arithmetic calculation in the field row of the query

"design
view" , I believe this is called a calculated field.

In the Criteria row of design Query I have ".85" (same column).

This works OK and selects the correct records.

However, the criteria often changes for example from ".85" to ".89"

and
rather then changing the Criteria manually I would like to be prompted

to
enter .85 or .89 or .73 and have it treated as if I had manually typed

the
value.

I have reviewed the HELP documentation and can do not see how to get

this
done.

Does anyone have a suggestion??

Thank You,
Greg






  #4  
Old April 15th, 2005, 12:06 PM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default

It works fine for me.

Check any Access book on Parameter Queries. It will say exactly the same as
I wrote.

Post your SQL String and what you did.

--
HTH
Van T. Dinh
MVP (Access)



"Greg Jesky" wrote in message
...
Van,
I don't beleive it worked.
I put into the criteria field what you suggested and input .85 when

prompted
but selected 0 records.
I put into the criteria column .85 and selected 2 records from the same
test data. I hope I understood your suggestion..
Thank You,
Greg



  #5  
Old April 15th, 2005, 03:10 PM
Greg Jesky
external usenet poster
 
Posts: n/a
Default

Van,
Thank You for your patience. Immediately below is the SQL generated by
Access with .85 in the Criteria row:

SELECT [TBL-Wireless Unit Mo Bill (B)].[Unit No], [TBL-Wireless Unit Mo Bill
(B)].[Bill Date], [TBL-Wireless Unit Mo Bill (B)].[BillingAccount Number],
[TBL-Wireless Unit Mo Bill (B)].[Monthly Access Charge], [TBL-Wireless Unit
Mo Bill (B)].[Total Current Unit Charge], [TBL-Wireless Unit Mo Bill
(B)].[Current Peak Usage Min]
FROM [TBL-Wireless Unit Mo Bill (B)]
WHERE ((([TBL-Wireless Unit Mo Bill (B)]![Current Peak Usage
Min]/([TBL-Wireless Unit Mo Bill (B)]![Allowance Minutes]+0.01))0.85));

Listed below is the SQL generated by Access with your suggestion included:


SELECT [TBL-Wireless Unit Mo Bill (B)].[Unit No], [TBL-Wireless Unit Mo Bill
(B)].[Bill Date], [TBL-Wireless Unit Mo Bill (B)].[BillingAccount Number],
[TBL-Wireless Unit Mo Bill (B)].[Monthly Access Charge], [TBL-Wireless Unit
Mo Bill (B)].[Total Current Unit Charge], [TBL-Wireless Unit Mo Bill
(B)].[Current Peak Usage Min]
FROM [TBL-Wireless Unit Mo Bill (B)]
WHERE ((([TBL-Wireless Unit Mo Bill (B)]![Current Peak Usage
Min]/([TBL-Wireless Unit Mo Bill (B)]![Allowance Minutes]+0.01))[ Enter
Limit Value:]));

I have just determined how to get it to work. YOU ARE CORRECT!! When I
enter" .85 "at the prompt I receive incorrect results.

When I enter" 0.85 "at the prompt I get correct results.

Does the same happen to you?
I did not find anything in Help to describe this situation.

Thank You again for your assistance,
Greg










"Van T. Dinh" wrote in message
...
It works fine for me.

Check any Access book on Parameter Queries. It will say exactly the same

as
I wrote.

Post your SQL String and what you did.

--
HTH
Van T. Dinh
MVP (Access)



"Greg Jesky" wrote in message
...
Van,
I don't beleive it worked.
I put into the criteria field what you suggested and input .85 when

prompted
but selected 0 records.
I put into the criteria column .85 and selected 2 records from the same
test data. I hope I understood your suggestion..
Thank You,
Greg





  #6  
Old April 15th, 2005, 03:37 PM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default

I was concerned about the implicit 0 in front of the decimal point but when
I tested, it worked fine with and without 0. I didn't put a space as the
first character, though.

--
HTH
Van T. Dinh
MVP (Access)


"Greg Jesky" wrote in message
...
Van,
Thank You for your patience. Immediately below is the SQL generated by
Access with .85 in the Criteria row:

SELECT [TBL-Wireless Unit Mo Bill (B)].[Unit No], [TBL-Wireless Unit Mo

Bill
(B)].[Bill Date], [TBL-Wireless Unit Mo Bill (B)].[BillingAccount Number],
[TBL-Wireless Unit Mo Bill (B)].[Monthly Access Charge], [TBL-Wireless

Unit
Mo Bill (B)].[Total Current Unit Charge], [TBL-Wireless Unit Mo Bill
(B)].[Current Peak Usage Min]
FROM [TBL-Wireless Unit Mo Bill (B)]
WHERE ((([TBL-Wireless Unit Mo Bill (B)]![Current Peak Usage
Min]/([TBL-Wireless Unit Mo Bill (B)]![Allowance Minutes]+0.01))0.85));

Listed below is the SQL generated by Access with your suggestion included:


SELECT [TBL-Wireless Unit Mo Bill (B)].[Unit No], [TBL-Wireless Unit Mo

Bill
(B)].[Bill Date], [TBL-Wireless Unit Mo Bill (B)].[BillingAccount Number],
[TBL-Wireless Unit Mo Bill (B)].[Monthly Access Charge], [TBL-Wireless

Unit
Mo Bill (B)].[Total Current Unit Charge], [TBL-Wireless Unit Mo Bill
(B)].[Current Peak Usage Min]
FROM [TBL-Wireless Unit Mo Bill (B)]
WHERE ((([TBL-Wireless Unit Mo Bill (B)]![Current Peak Usage
Min]/([TBL-Wireless Unit Mo Bill (B)]![Allowance Minutes]+0.01))[ Enter
Limit Value:]));

I have just determined how to get it to work. YOU ARE CORRECT!! When I
enter" .85 "at the prompt I receive incorrect results.

When I enter" 0.85 "at the prompt I get correct results.

Does the same happen to you?
I did not find anything in Help to describe this situation.

Thank You again for your assistance,
Greg




  #7  
Old April 15th, 2005, 03:54 PM
JohnFol
external usenet poster
 
Posts: n/a
Default

Might be worth checking if these are text or numeric fields ... .. .
Then, in the parameters dialog box in the QBE, add the [Enter Limit Value:]
with the appropriate datatype



"Van T. Dinh" wrote in message
...
It works fine for me.

Check any Access book on Parameter Queries. It will say exactly the same
as
I wrote.

Post your SQL String and what you did.

--
HTH
Van T. Dinh
MVP (Access)



"Greg Jesky" wrote in message
...
Van,
I don't beleive it worked.
I put into the criteria field what you suggested and input .85 when

prompted
but selected 0 records.
I put into the criteria column .85 and selected 2 records from the same
test data. I hope I understood your suggestion..
Thank You,
Greg





  #8  
Old April 17th, 2005, 12:30 AM
Greg Jesky
external usenet poster
 
Posts: n/a
Default

JohnFol,
Both fields used in the calculation are defined as long integers. Can you
please explain your suggestion about adding the appropriate data type in the
parameter dialog box. I don't follow because and I am relatively new at this
and I am trying to learn.
Thank You,
Greg


"JohnFol" wrote in message
...
Might be worth checking if these are text or numeric fields ... .. .
Then, in the parameters dialog box in the QBE, add the [Enter Limit

Value:]
with the appropriate datatype



"Van T. Dinh" wrote in message
...
It works fine for me.

Check any Access book on Parameter Queries. It will say exactly the

same
as
I wrote.

Post your SQL String and what you did.

--
HTH
Van T. Dinh
MVP (Access)



"Greg Jesky" wrote in message
...
Van,
I don't beleive it worked.
I put into the criteria field what you suggested and input .85 when

prompted
but selected 0 records.
I put into the criteria column .85 and selected 2 records from the

same
test data. I hope I understood your suggestion..
Thank You,
Greg







  #9  
Old April 17th, 2005, 03:08 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default

In the Query DesignView, use the Menu Query / Parameter ... and you can set
the Parameter DataType in the Dialog.

OTOH, Access guesses right virtually every time for me so I don't bother
with this. The only exception is parametrised Cross-Tab Queries and Access
insists on declaring the Data Type of the Parameter(s).

--
HTH
Van T. Dinh
MVP (Access)




"Greg Jesky" wrote in message
...
JohnFol,
Both fields used in the calculation are defined as long integers. Can you
please explain your suggestion about adding the appropriate data type in

the
parameter dialog box. I don't follow because and I am relatively new at

this
and I am trying to learn.
Thank You,
Greg




  #10  
Old April 18th, 2005, 05:23 AM
Greg Jesky
external usenet poster
 
Posts: n/a
Default

Van,
Thank You,
Greg

"Van T. Dinh" wrote in message
...
In the Query DesignView, use the Menu Query / Parameter ... and you can

set
the Parameter DataType in the Dialog.

OTOH, Access guesses right virtually every time for me so I don't bother
with this. The only exception is parametrised Cross-Tab Queries and

Access
insists on declaring the Data Type of the Parameter(s).

--
HTH
Van T. Dinh
MVP (Access)




"Greg Jesky" wrote in message
...
JohnFol,
Both fields used in the calculation are defined as long integers. Can

you
please explain your suggestion about adding the appropriate data type in

the
parameter dialog box. I don't follow because and I am relatively new at

this
and I am trying to learn.
Thank You,
Greg






 




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
adding column with numbers in query Giz Running & Setting Up Queries 15 February 11th, 2005 11:09 AM
adding 2 fields including null entries Jesse Running & Setting Up Queries 26 January 18th, 2005 05:31 PM
dynamic crosstab A2002 Brigitte P Running & Setting Up Queries 13 January 2nd, 2005 04:25 PM
Financial Comparison Steven Cheng Setting Up & Running Reports 13 November 26th, 2004 10:59 PM
Parameter Query to select records Joe Running & Setting Up Queries 3 June 10th, 2004 02:05 AM


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