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  

Double data type in query rounds when criteria is present



 
 
Thread Tools Display Modes
  #1  
Old July 2nd, 2005, 09:27 PM
Gray Sadler via AccessMonster.com
external usenet poster
 
Posts: n/a
Default Double data type in query rounds when criteria is present

I have a select query that looks up values from a table based on a control I
have in a form. In the query, one value's datatype is Double, and the other
is Text. The criteria I have in the query is under Text where it looks up the
value from a control on a form. When this criteria is present, it rounds my
Double datatype, but without the criteria it doesn't. Has anyone heard of
this? I'm stumped. If anyone could help I would greatly appreciate it!

Gray

--
Message posted via http://www.accessmonster.com
  #2  
Old July 3rd, 2005, 12:07 AM
Pat Hartman
external usenet poster
 
Posts: n/a
Default

You may have to post your code for us to see the problem but you can try:
Where SomeField = CDbl(Forms!frmYourForm!SomeField)
"Gray Sadler via AccessMonster.com" wrote in
message ...
I have a select query that looks up values from a table based on a control

I
have in a form. In the query, one value's datatype is Double, and the

other
is Text. The criteria I have in the query is under Text where it looks up

the
value from a control on a form. When this criteria is present, it rounds

my
Double datatype, but without the criteria it doesn't. Has anyone heard of
this? I'm stumped. If anyone could help I would greatly appreciate it!

Gray

--
Message posted via http://www.accessmonster.com



  #3  
Old July 3rd, 2005, 12:35 AM
Gray Sadler via AccessMonster.com
external usenet poster
 
Posts: n/a
Default

I tried CDbl() and it still rounds the number. Here's my SQL:

SELECT PAYROLL.policyNum, PAYROLL.rate
FROM PAYROLL
WHERE (((PAYROLL.policyNum)=[Forms]![frmMain]![policyNum]));

policyNum's datatype is actually a Long Int. and rate is Double. When I do
the select query without the WHERE, it shows the correct 'rate', which is not
rounded. An example of what it should look like is: .0064. It's either
rounding the double datatype or changing the data type all together. I can't
figure it out.

--
Message posted via http://www.accessmonster.com
  #4  
Old July 3rd, 2005, 01:58 AM
Ken Snell [MVP]
external usenet poster
 
Posts: n/a
Default

How are you using this query? In other words, when does it run? What runs
it? How are you displaying the results of the query?

I must say that I've never run across this situation previously, so I'm
wondering if it has to do with the context for the query's run.

--

Ken Snell
MS ACCESS MVP

"Gray Sadler via AccessMonster.com" wrote in
message ...
I tried CDbl() and it still rounds the number. Here's my SQL:

SELECT PAYROLL.policyNum, PAYROLL.rate
FROM PAYROLL
WHERE (((PAYROLL.policyNum)=[Forms]![frmMain]![policyNum]));

policyNum's datatype is actually a Long Int. and rate is Double. When I do
the select query without the WHERE, it shows the correct 'rate', which is
not
rounded. An example of what it should look like is: .0064. It's either
rounding the double datatype or changing the data type all together. I
can't
figure it out.

--
Message posted via http://www.accessmonster.com



  #5  
Old July 3rd, 2005, 02:15 AM
Gray Sadler via AccessMonster.com
external usenet poster
 
Posts: n/a
Default

As of right now, the query is only opened manually. The results are displayed
in spreadsheet view. This is how I noticed it...today I noticed that the
'rate' field was rounding. I realized that the data type for 'rate' was a
Long Integer, so I changed it to Double. When I opened the table, I then saw
the correct 'rates' with decimals. But when I created a query that had
'policyNum' from a form as the criteria for the query, it still rounded.

I've been playing around with this almost all day, and it seems that there is
something special about this table, because other tables with decimals query
just fine.

--
Message posted via http://www.accessmonster.com
  #6  
Old July 3rd, 2005, 02:56 AM
Gray Sadler via AccessMonster.com
external usenet poster
 
Posts: n/a
Default

I fixed it. I deleted all records, compacted, and put the records back in. I
still don't know how that happened.

--
Message posted via http://www.accessmonster.com
 




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
Convert data type in Query Mary Running & Setting Up Queries 2 January 7th, 2005 11:41 PM
Format on data to import to Access tables? (I need your advice) Niklas Östergren General Discussion 5 December 13th, 2004 02:54 PM
Query Should run but Data Type Mismatch error news.paradise.net.nz Running & Setting Up Queries 1 September 9th, 2004 01:19 PM
Print Taher Setting Up & Running Reports 1 August 31st, 2004 09:07 PM
Newbie? Do I use Report or Query John Egan New Users 11 June 28th, 2004 08:31 PM


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