Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help with ADO and VBScript!


Hi expert,

I have to say that I have no experience in VBscript before, I am a dat
warehouse analyst and need to complete a report out of SQL Server.

I need to have a little excel vbscript with ADO recordset code t
change the first column, when it's starts with first letter 'D', then
will have to replace the cell to a district manager name.

First of all, I need to loop every row in column A only to find an
cell with a 'D' prefixed word, for example, D1009.
Then open a ADO connect to SQL Server and here is the SQL query:
SELECT 'D' + CAST(District_Num AS char(5)) AS DISTRICT, DISTRICT_MGR
FROM micros.Store_Table

As long as I find the cell to match DISTRICT, then it needs to b
replaced by DISTRICT_MGR

Can someone show me the VBScript to complete this task?

Thank you

--
jenh
-----------------------------------------------------------------------
jenhu's Profile: http://www.excelforum.com/member.php...fo&userid=2896
View this thread: http://www.excelforum.com/showthread.php?threadid=52550

  #2   Report Post  
Posted to microsoft.public.excel.programming
MH MH is offline
external usenet poster
 
Posts: 30
Default Please help with ADO and VBScript!

Why not do it in SQL Server using a Stored Procedure?

MH

"jenhu" wrote in
message ...

Hi expert,

I have to say that I have no experience in VBscript before, I am a data
warehouse analyst and need to complete a report out of SQL Server.

I need to have a little excel vbscript with ADO recordset code to
change the first column, when it's starts with first letter 'D', then I
will have to replace the cell to a district manager name.

First of all, I need to loop every row in column A only to find any
cell with a 'D' prefixed word, for example, D1009.
Then open a ADO connect to SQL Server and here is the SQL query:
SELECT 'D' + CAST(District_Num AS char(5)) AS DISTRICT, DISTRICT_MGR
FROM micros.Store_Table

As long as I find the cell to match DISTRICT, then it needs to be
replaced by DISTRICT_MGR

Can someone show me the VBScript to complete this task?

Thank you.


--
jenhu
------------------------------------------------------------------------
jenhu's Profile:
http://www.excelforum.com/member.php...o&userid=28969
View this thread: http://www.excelforum.com/showthread...hreadid=525501



Reply
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
Run VBScript from Excel Amy M Excel Discussion (Misc queries) 4 September 19th 08 09:07 PM
Excel & VBScript Bill Ebbing Excel Programming 7 September 8th 05 06:27 PM
vbscript question... rosen Excel Programming 1 December 28th 04 10:58 PM
VBscript sebastienm Excel Programming 0 September 22nd 04 08:24 PM
VBscript raji Excel Programming 0 September 22nd 04 08:03 PM


All times are GMT +1. The time now is 03:57 PM.

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"