Forum Discussion

Chancellor1141's avatar
Chancellor1141
Copper Contributor
Jan 03, 2022

Access back end with Visual Studio

I have written a query in MS access which is returning the data that I want. 

There are a numerous amount of IIF statements in the query but again, returning the data that I want.

 

The problem is that when I try to use the data in Visual Studio.  Using Closed XML I am trying to output this query to Excel using code. 

The returns on IIFs are not the same. 

For instance:

Iif( p.parameter LIKE "u-*", "Radionuclides", Iif( p.parameter LIKE "*uranium*", "Radionuclides", km.description ) ) ) AS MethodGroup

 

In the query when I look at it with Access, I am seeing the radionuclides methodgroup.  BUT, when I run the query through Visual Studio and output it to Excel, there is no radionuclides methodgroup.

It's like the IIF is not working.

 

I am not even sure what to Google to begin to research this problem.

 

  • JurgenGeelen's avatar
    JurgenGeelen
    Brass Contributor
    Maybe you can try this:

    Iif( Left(p.parameter,2) = "u-", "Radionuclides", Iif( Instr(1,p.parameter."uranium")>0, "Radionuclides", km.description ) ) AS MethodGroup

Resources