Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Retrieving 2 or more values from a DB query
#7
Solved: 11 Years, 4 Months, 4 Weeks ago
Hi Basanth,

I guess I am still confused at the disconnect here. It seems the 1st variable adj(0) has both values stored. I cannot separate them successfully. I understand the arrays concept but am not familiar with the Split function.

So I updated my code to print out the 2 values after the For statement:

adj = Split(val2, VBLF)
For i = Lbound(adj) to Ubound(adj)
msgbox adj(i)
Next

msgbox adj(0)
msgbox adj(1)

When I run this, msgbox adj(0) prints out:
TRAIN1
TRAIN2

and msgbox adj(1) throws an error:

Subscript out of range: '[number: 1]'
Line (37): "msgbox adj(1)".

I will look more into the Split function, but if you have further suggestions I appreciate the help...

-egun

Okay, From the Msgbox adj(0) it is clear that the split has not happened.

Lets try with this,
Code:
adj = Split(Val2, " ")
msgbox adj(0)

Okay, From the Msgbox adj(0) it is clear that the split has not happened.

Lets try with this,
Code:
adj = Split(Val2, " ")
msgbox adj(0)

Quickly, While you try the above, please try the below too,
Code:
adj = Split(Val2, VBCR)
msgbox adj(0)

Okay, From the Msgbox adj(0) it is clear that the split has not happened.

Lets try with this,
Code:
adj = Split(Val2, " ")
msgbox adj(0)


Okay, From the Msgbox adj(0) it is clear that the split has not happened.

Lets try with this,
Code:
adj = Split(Val2, " ")
msgbox adj(0)


Quickly, While you try the above, please try the below too,
Code:
adj = Split(Val2, VBCR)
msgbox adj(0)


Egun -
I have confirmed the below works fine and is the solution you are looking for.
Code:
adj = Split(val2, VBCR)
For i = Lbound(adj) to Ubound(adj)
msgbox adj(i)
Next
This should store the required values from adj(0), adj(1) etc...

Please try this and let me know if it works !! I am here for the next 10 mins hoping to see your reply.
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply


Messages In This Thread
RE: Retrieving 2 or more values from a DB query - by basanth27 - 09-04-2009, 07:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Query regarding "Call" statement anupam4j 1 2,071 09-26-2014, 01:46 PM
Last Post: vinod123
  Retrieving data from web table nsuresh316 1 3,159 03-03-2014, 08:29 AM
Last Post: basanth27
  Data Table Query Suma Parimal 4 4,837 01-21-2014, 12:50 PM
Last Post: Suma Parimal
  UFT Query invisible786 0 1,933 01-15-2014, 09:41 PM
Last Post: invisible786
  Retrieving data from Txt file into datatable kriday 3 5,850 07-23-2013, 11:04 AM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 3 Guest(s)