By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,099 Members | 1,364 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,099 IT Pros & Developers. It's quick & easy.

Record Set Issues Help

P: 3
This is a part of my code in VB:

.
.
Expand|Select|Wrap|Line Numbers
  1. Dim rsora1 As ADODB.Recordset
  2. .
  3. .
  4. Set cnOra = New ADODB.Connection
  5. .
  6. .
  7. Set rsora1 = New ADODB.Recordset
  8. .
  9. .
  10. rsora1.CursorLocation = adUseServer
  11. .
  12. .
  13. If Worksheets.Item("sheet1").Cells(j + b, i).Value <> rsora1![val_arr] Then
i want to compare the value in a cell in excel to the value in the resultset. the problem is that <val_arr> in rsora1![ ] is a array variable(of type string), ie, a(i-3)=val_arr. How do i go about it???
Mar 14 '07 #1
Share this Question
Share on Google+
5 Replies


100+
P: 1,646
Hi. In the code you have posted, rsora1 has not been populated with any values. Could you post the code where val_arr is declared and assigned a value?
Mar 14 '07 #2

P: 3
Hi. In the code you have posted, rsora1 has not been populated with any values. Could you post the code where val_arr is declared and assigned a value?
here i populate rsora1:
rsora1.Open "select rowid,CUSTOMER_ID,ITEM_NO,ITEM_DESCRIPTION,BEGIN_D ATE,END_DATE from XXITEM_MAP_TABLE where CUSTOMER_NO = " & cust_no, cnOra, adOpenForwardOnly (cust_no is a variable containing a value)

these are the array values:
a(0) = "CUSTOMER_ID"
a(1) = "ITEM_NO"
a(2) = "ITEM_DESCRIPTION"
a(3) = "BEGIN_DATE"
a(4) = "END_DATE"

i use a loop to get the specific value from the array:
For i = 3 To 13 Step 2
val_arr = a((i - 3) / 2)

now i do this:
If Worksheets.Item("sheet1").Cells(j + b, i).Value <> rsora1![val_arr] Then.....
but i can't get rsora1![val_arr] to point to a particular value in the resultset.
help me!!
Mar 15 '07 #3

100+
P: 1,646
The syntax for ado is:
Expand|Select|Wrap|Line Numbers
  1. rsora1(val_arr)
I have never used a variable here and I recommend that you don't either. It is far easier for you to use this syntax:
Expand|Select|Wrap|Line Numbers
  1. rsora1((i - 3) / 2)
The result of this loop:
Expand|Select|Wrap|Line Numbers
  1. For i = 3 To 13 Step 2
  2. val_arr = a((i - 3) / 2)
Is that val_arr always ends the loop as a(5) and there is no a(5)
Mar 15 '07 #4

P: 3
The syntax for ado is:
Expand|Select|Wrap|Line Numbers
  1. rsora1(val_arr)
I have never used a variable here and I recommend that you don't either. It is far easier for you to use this syntax:
Expand|Select|Wrap|Line Numbers
  1. rsora1((i - 3) / 2)
The result of this loop:
Expand|Select|Wrap|Line Numbers
  1. For i = 3 To 13 Step 2
  2. val_arr = a((i - 3) / 2)
Is that val_arr always ends the loop as a(5) and there is no a(5)
problem solved
thanx a million
Mar 15 '07 #5

100+
P: 1,646
problem solved
thanx a million
You are very welcome
Mar 15 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.