LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SQL CASE statement on EXCEL VBA

Hello folks ! How can I use CASE WHEN statement on excel vba ? I'm using
excel sheet like database I did :

dim db as dao.database
dim rs as dao.recordset
dim cSQL as string

set db=opendatabase(thisworkbook.path & "\" &
thisworkbook.name,false,false,"Excel 8.0")

cSQL="select cd_codigo, (case when cd_hist=1 then valor else 0 end), (case
when cd_hist=2 then valor else 0 end) from [Plan1$]"

set rs=db.openrecordset(cSQL)

but this code make a error. Why ?

regards.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Case Statement jlclyde Excel Discussion (Misc queries) 3 December 4th 08 05:04 PM
CASE statement equivalent Beema Excel Worksheet Functions 1 December 15th 04 09:32 AM
Case Statement error David Adamson[_3_] Excel Programming 2 June 23rd 04 05:01 AM
Case Statement Help stck2mlon Excel Programming 3 June 2nd 04 01:44 PM
Case statement smi Excel Programming 2 October 18th 03 02:20 PM


All times are GMT +1. The time now is 07:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"