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 Several sql queries with the same recordset


Hi everybody

İ need to do several queries. But i don't know how to proceed wit
one recordset.

So i trıed to close and open a new one. (in the if statemen
loop)

Unfortunately this trick desn't work. Does somebody has a clue abou
that ?

Here is a part of my code


Set rs = New ADODB.Recordset

For i = 1 To 200

myAcc = Sheets("0904").Cells(i, 1).Value

mySql1 = "SELECT account from balance where (account='" & myAcc & "')"
mySql3 = "INSERT into balance (account,04 january) VALUES ('" & myAcc
"', 200)"
mySql4 = "UPDATE balance SET [04 january] = '500' WHERE account = '"
myAcc & "'"

rs.Open mySql1, cn, adOpenStatic
Range("A" & i).Value = rs.RecordCount
Range("B" & i).CopyFromRecordset rs
rs.Close

If (Range("B" & i).Value 0) Then
rs.Open mySql4, cn, adOpenStatic
rs.Close
Else
rs.NextRecordset mySql3, cn, adOpenStatic
rs.Close
End If

Next i

:eek

--
fbonnar
-----------------------------------------------------------------------
fbonnard's Profile: http://www.excelforum.com/member.php...fo&userid=1597
View this thread: http://www.excelforum.com/showthread.php?threadid=27446

 
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
query a recordset SAm Excel Discussion (Misc queries) 2 May 1st 07 09:33 PM
DAO Recordset in Excel Andy Excel Programming 2 October 3rd 04 12:13 AM
Type recordset/recordset? FlaviusFlav[_9_] Excel Programming 4 May 24th 04 12:16 PM
Viewing Recordset in SQL help please HS[_3_] Excel Programming 0 October 8th 03 12:01 AM
Recordset Stephan Kassanke Excel Programming 0 September 10th 03 04:45 PM


All times are GMT +1. The time now is 01:40 PM.

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

About Us

"It's about Microsoft Excel"