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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Decode function



 
 
Thread Tools Display Modes
  #1  
Old September 28th, 2009, 03:11 PM posted to microsoft.public.access.reports
[email protected]
external usenet poster
 
Posts: 5
Default Decode function

Dear all,

I'm just new in access databases (using MSaccess 2003)
I've a native application generating an sql code against an oracle
database.
I 'd like to use this code in access via a linked table but my sql
using a "decode" function (transforming 1 into "Y" and 0 into "No".

What would be the equivalent via access?

Thanks in advance

TT
  #2  
Old September 28th, 2009, 04:19 PM posted to microsoft.public.access.reports
Dorian
external usenet poster
 
Posts: 542
Default Decode function

You can just write a public function in VB that does the conversion.
The function will accept 1 or 0 as a parameter and return Y or No.
Call the function from your query.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


" wrote:

Dear all,

I'm just new in access databases (using MSaccess 2003)
I've a native application generating an sql code against an oracle
database.
I 'd like to use this code in access via a linked table but my sql
using a "decode" function (transforming 1 into "Y" and 0 into "No".

What would be the equivalent via access?

Thanks in advance

TT

  #3  
Old September 28th, 2009, 04:23 PM posted to microsoft.public.access.reports
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Decode function

You could use IIF like this --
IIF([YourField] = 1, "Y", "No")
unless there maybe other entries besides 1 and 0. Then this --
IIF([YourField] = 1, "Y", IIF([YourField] = 0, "No", "Error")))

--
Build a little, test a little.


" wrote:

Dear all,

I'm just new in access databases (using MSaccess 2003)
I've a native application generating an sql code against an oracle
database.
I 'd like to use this code in access via a linked table but my sql
using a "decode" function (transforming 1 into "Y" and 0 into "No".

What would be the equivalent via access?

Thanks in advance

TT

  #4  
Old September 28th, 2009, 04:34 PM posted to microsoft.public.access.reports
[email protected]
external usenet poster
 
Posts: 5
Default Decode function

On Sep 28, 5:23*pm, KARL DEWEY
wrote:
You could use IIF like this --
* * * IIF([YourField] = 1, "Y", "No")
* *unless there maybe other entries besides 1 and 0. *Then this --
* * * IIF([YourField] = 1, "Y", IIF([YourField] = 0, "No", "Error")))

--
Build a little, test a little.



" wrote:
Dear all,


I'm just new in access databases (using MSaccess 2003)
I've a native application generating an sql code against an oracle
database.
I 'd like to use this code in access via a linked table but my sql
using a "decode" function (transforming 1 into "Y" and 0 into "No".


What would be the equivalent via access?


Thanks in advance


TT- Hide quoted text -


- Show quoted text -


works perfect !
THanks
 




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


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