Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

swap data seperated by comma

Status
Not open for further replies.

tyutghf

Technical User
Apr 12, 2008
258
GB
In a database I have lat and long values in the format

51.76875616, 1.272628

When I grab them for use in anotehr application I need to pass oevr the values in reverse, i.e.

1.272628, 51.76875616

How do I do this? I am using rs("latlong") to grab the original data.

Thanks folks
 
What is your actual concern? For instance this, is it enough for the purpose?
[tt]
dim x,y,a,i
x=rs("latlong").value
a=split(x,",")
y=""
for i=ubound(a) to 0 step -1
y=y & a(i)
if i<>0 then
y=y & ","
end if
next
'send y instead x
[/tt]
 
Perhaps in the database you could store lat in one field and long in another and then it might be easier to work with.

 
You could try (sorry a little rusty)

vLatLong = right(rs("latlong"), len(rs("latlong")) - (instr(rs("latlong"),",")) + 1) & ", " & left(rs("latlong"), len(rs("latlong")) - (instr(rs("latlong"),",")-1))

thats the easy way i think, takes right from the comma and removes an extra one for the space... addds ", " to the string... then takes left upto the comma....

any good??



daveJam

even my shrink says its all your f#@/ing fault
 
sorry I was sure I had responded to this post, obviously dreampt it?!?!

tsuji's response was exactly what I was looking for although I can see what you have done davejam, thanks for that
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top