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  

#Error in query



 
 
Thread Tools Display Modes
  #1  
Old June 1st, 2006, 11:46 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default #Error in query

Hello,

I have a table R,

ID as number
T as text

| ID | T |
| 1 | A01 |
| 2 | CEE |
| 3 | Z33 |

if the two right characters is numeric return numeric value else the two
right characters , in this example

| ID | T |
| 1 | 1 |
| 2 | EE |
| 3 | 33 |

i try this query:

SELECT ID, IIF(IsError(Right(T,2) *1),Right(T,2) ,Right(T,2) *1) FROM R

and the query not trap the error, it is possible get this.

thank's



  #2  
Old June 2nd, 2006, 12:38 AM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default #Error in query


"Carlos" wrote in message
...
Hello,

I have a table R,

ID as number
T as text

| ID | T |
| 1 | A01 |
| 2 | CEE |
| 3 | Z33 |

if the two right characters is numeric return numeric value else the two
right characters , in this example

| ID | T |
| 1 | 1 |
| 2 | EE |
| 3 | 33 |


If the number can never be zero, try

IIF(Val(Right([T], 2) = 0, Right([T], 2), Val(Right(T), 2))

However, since you're allowing a Text value to be a valid result, the field
will be of Text datatype in any case. You CANNOT have a field which contains
text in a Number datatype.


--
John W. Vinson/MVP


 




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
Toolbars, Drop-Down Menus Rick New Users 1 September 21st, 2005 11:17 AM
SQL query showing diff between actual and budget Bon Running & Setting Up Queries 3 August 25th, 2005 12:07 PM
Nested in-line Query laura Running & Setting Up Queries 0 February 11th, 2005 12:17 AM
Here's a shocker Mike Labosh General Discussion 2 October 26th, 2004 05:04 PM
Too Few Parameters error Mail Merge Access Parameter Query Tony_VBACoder Mailmerge 3 September 14th, 2004 12:15 PM


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