MSACCESS Visual Basic program help needed in recordset

I have run the code and it certainly seems to work but I don't understand how it can. Query references a linked table SITES_INFO_GOOGLE.mdb which has a link path C:\Data\GE. I do not have such folder nor mdb file. I try to open the query object and it triggers 'invalid path error', yet the code opening recordset based on the same query works. Can you explain this?

There is no use of SITES_INFO_GOOGLE.mdb, please run the code, when we enter the cell name, it's get the neighbor list from Links declared and sets the recordset. by using do while loop each and every neighbor created the line by using the KML Header, KML body and KML footer.

In this, my query is, we need to create the one color for 1st 5 neighbors and the remaining with other color,

if you still have doubt, please take help from any other experts but please help me to send the code,
Thanks....
 
Why do you think it is possible to change the line color after 5 records (5 neighbours)?
Then when I look at the data generated in the NBR.Kml - file, then the 1 line is the header where the line color is given.
If you've seen any sample of that, look at the generated source in the Browser maybe it can give you some ideas.
 
Why do you think it is possible to change the line color after 5 records (5 neighbours)?
Then when I look at the data generated in the NBR.Kml - file, then the 1 line is the header where the line color is given.
If you've seen any sample of that, look at the generated source in the Browser maybe it can give you some ideas.

if we change the color for 1st 5 neighbors, its very easy to identify the poor performing neighbors,
if we make 2 macros: one for 1st 5 neighbors, and the 2nd for rest neighbors, also ok....
kindly help me....
Thanks....
 
..
kindly help me....
Thanks....
I can't help you, when you not answer my questions so:

  • Why do you think it is possible to change the line color after 5 records (5 neighbours)?
  • Have you seen any sample of that, then look at the generated source in the Browser, maybe it can give you some ideas.
 
The code loops through recordset to build kml_Body. The recordset source is query [Qry_2GNeiFind_3G] or [Qry_3GNeiFind_3G] depending on length of Source_Cell value. Query [Qry_2GNeiFind_3G] uses table links ([2G] and [3G]) referencing SITES_INFO_GOOGLE.mdb. The code will fail if the conditional hits that query, apparently I have not yet. Confusion now rectified.

I think what you need is a second Style built into the header. Then conditionally replace the StyleID in the Placemark string.

Code:
kml_Style1 = "<Style id=" & Chr(34) & "3GLinks1" & Chr(34) & ">" & vbLf & _
             "<IconStyle>" & vbLf & _
             "<scale>0.9</scale>" & vbLf & _
             "<Icon>" & vbLf & _
             "<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>" & vbLf & _
             "</Icon>" & vbLf & _
             "<hotSpot x=" & Chr(34) & "20" & Chr(34) & " y=" & Chr(34) & "2" & Chr(34) & " xunits=" & Chr(34) & "pixels" & Chr(34) & " yunits=" & Chr(34) & "pixels" & Chr(34) & "/>" & vbLf & _
             "</IconStyle>" & vbLf & _
             "<LineStyle>" & vbLf & _
             "<color>ff0000ff</color>" & vbLf & _
             "<width>0.9</width>" & vbLf & _
             "</LineStyle>" & vbLf & _
             "</Style>"
             
kml_Style2 = "<Style id=" & Chr(34) & "3GLinks2" & Chr(34) & ">" & vbLf & _
             "<IconStyle>" & vbLf & _
             "<scale>0.9</scale>" & vbLf & _
             "<Icon>" & vbLf & _
             "<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>" & vbLf & _
             "</Icon>" & vbLf & _
             "<hotSpot x=" & Chr(34) & "20" & Chr(34) & " y=" & Chr(34) & "2" & Chr(34) & " xunits=" & Chr(34) & "pixels" & Chr(34) & " yunits=" & Chr(34) & "pixels" & Chr(34) & "/>" & vbLf & _
             "</IconStyle>" & vbLf & _
             "<LineStyle>" & vbLf & _
             "<color>ffffff00</color>" & vbLf & _
             "<width>0.9</width>" & vbLf & _
             "</LineStyle>" & vbLf & _
             "</Style>"
             
kml_Header = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "UTF-8" & Chr(34) & "?>" & vbLf & _
             "<kml xmlns=" & Chr(34) & "[URL]http://earth.google.com/kml/2.2[/URL]" & Chr(34) & ">" & vbLf & _
             "<Document>" & vbLf & _
             "<name>NBR.kml</name>" & vbLf & _
             kml_Style1 & vbLf & _
             kml_Style2 & vbLf & _
             "<Folder><name>NBR</name><open>1</open>" & vbLf

Code:
          Do While i > 0
              kml_Body = kml_Body & vbLf & _
                           Replace(rst!Placemark_1, "3GLinks", IIf(i <= 5, "3GLinks1", "3GLinks2")) & _
                           rst!Placemark_2
              rst.MoveNext
              i = i - 1
          Loop
 
The code loops through recordset to build kml_Body. The recordset source is query [Qry_2GNeiFind_3G] or [Qry_3GNeiFind_3G] depending on length of Source_Cell value. Query [Qry_2GNeiFind_3G] uses table links ([2G] and [3G]) referencing SITES_INFO_GOOGLE.mdb. The code will fail if the conditional hits that query, apparently I have not yet. Confusion now rectified.

I think what you need is a second Style built into the header. Then conditionally replace the StyleID in the Placemark string.

Code:
kml_Style1 = "<Style id=" & Chr(34) & "3GLinks1" & Chr(34) & ">" & vbLf & _
             "<IconStyle>" & vbLf & _
             "<scale>0.9</scale>" & vbLf & _
             "<Icon>" & vbLf & _
             "<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>" & vbLf & _
             "</Icon>" & vbLf & _
             "<hotSpot x=" & Chr(34) & "20" & Chr(34) & " y=" & Chr(34) & "2" & Chr(34) & " xunits=" & Chr(34) & "pixels" & Chr(34) & " yunits=" & Chr(34) & "pixels" & Chr(34) & "/>" & vbLf & _
             "</IconStyle>" & vbLf & _
             "<LineStyle>" & vbLf & _
             "<color>ff0000ff</color>" & vbLf & _
             "<width>0.9</width>" & vbLf & _
             "</LineStyle>" & vbLf & _
             "</Style>"
             
kml_Style2 = "<Style id=" & Chr(34) & "3GLinks2" & Chr(34) & ">" & vbLf & _
             "<IconStyle>" & vbLf & _
             "<scale>0.9</scale>" & vbLf & _
             "<Icon>" & vbLf & _
             "<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>" & vbLf & _
             "</Icon>" & vbLf & _
             "<hotSpot x=" & Chr(34) & "20" & Chr(34) & " y=" & Chr(34) & "2" & Chr(34) & " xunits=" & Chr(34) & "pixels" & Chr(34) & " yunits=" & Chr(34) & "pixels" & Chr(34) & "/>" & vbLf & _
             "</IconStyle>" & vbLf & _
             "<LineStyle>" & vbLf & _
             "<color>ffffff00</color>" & vbLf & _
             "<width>0.9</width>" & vbLf & _
             "</LineStyle>" & vbLf & _
             "</Style>"
             
kml_Header = "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "UTF-8" & Chr(34) & "?>" & vbLf & _
             "<kml xmlns=" & Chr(34) & "[URL]http://earth.google.com/kml/2.2[/URL]" & Chr(34) & ">" & vbLf & _
             "<Document>" & vbLf & _
             "<name>NBR.kml</name>" & vbLf & _
             kml_Style1 & vbLf & _
             kml_Style2 & vbLf & _
             "<Folder><name>NBR</name><open>1</open>" & vbLf

Code:
          Do While i > 0
              kml_Body = kml_Body & vbLf & _
                           Replace(rst!Placemark_1, "3GLinks", IIf(i <= 5, "3GLinks1", "3GLinks2")) & _
                           rst!Placemark_2
              rst.MoveNext
              i = i - 1
          Loop

Excellent,
Great....
Many Thanks to you.....
 
Glad it's working for you.

But please, no need to quote entire post just to give a thank you.
 
Glad it's working for you.

But please, no need to quote entire post just to give a thank you.

Hi Master,
Good day....
i need one more small help, in the same program,


I have added few more columns in input file, and added the placemarks in macro to identify different colors for different values, and by using below code, its working fine

Code:
kml_Body = kml_Body & vbLf & _
Replace(rst!Placemark_1, "3GLinks", IIf(rst!FailCount <= 100, "3GLinks1", IIf(rst!FailCount > 100 And rst!FailCount <= 200, "3GLinks2", IIf(rst!FailCount > 200 And rst!FailCount <= 500, "3GLinks3", IIf(rst!FailCount > 500 And rst!FailCount <= 1000, "3GLinks4", "3GLinks5"))))) & _
 rst!Placemark_2

now my request is: when i using description code, 1. its not allowing <br> and only 3 columns values/details i can show when clicking on the line,

Code:
Placemark_1: "<Placemark><name>" & [3G3G declared]![4G Cell Code A] & "-" & [3G3G declared]![4G Cell Code B] & "</name><description><name>SuccessCount= </name>" & [3G3G declared]![SuccessCount] & "<name>TimeOutFail= </name>" & [3G3G declared]![TimeOutFail] & "<name>OthersFail= </name>" & [3G3G declared]![OthersFail] & "</description><styleUrl>#3GLinks</styleUrl><LineString><altitudeMode>relativeToGround</altitudeMode>"

Can you kindly help me to give the code to represent all of the columns, when click on particular link, if is shows the details, its more helpful....

Many many thanks to you in advance.....
 

Attachments

  • Input data.jpg
    Input data.jpg
    89 KB · Views: 59
  • GE Links with description.jpg
    GE Links with description.jpg
    102.3 KB · Views: 56

Users who are viewing this thread

Back
Top Bottom