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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |
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 |