Welcome Guest, posting in this forum requires registration. Forum » News And Discussions » News And Discussions » Access 2007 query conversion in .kml file and view in Google Earth This is working example of my code that converts Access 2007 query in Of course you should have stored coordinates - longitude/latitude It is posible using the princip of this code also to export any kind of POI formats - .gpx , .plt and etc. Up
Welcome Guest
Show/Hide Header
Pages: [1]
Author
Topic: Access 2007 query conversion in .kml file and view in Google Earth
admin
Posts: 4
Access 2007 query conversion in .kml file and view in Google Earth
on: June 23, 2011, 11:25
Google Earth .kml file
It is fully functional and I'm using it in my sales database.
also - name and description of poi database which have to be exported.Private Sub Command0_Click()
DoCmd.OpenQuery "QrySim"
Dim MyDB As DAO.Database
Dim MyRS As DAO.Recordset
Dim fld As Field
Dim strText As String
Dim MyTableName As String
Dim QryOrTblDef As String
Dim iFile As Integer
QryOrTblDef = "QrySim"
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset(QryOrTblDef)
iFile = FreeFile
Open "C:\Documents and Settings\ivantassev.UMC\Desktop\EXCELtoKML\DB\KMLIvan.kml" For Output Shared As #iFile
Print #iFile, "<?xml version=""1.0"" encoding=""utf-8""?>"
Print #iFile, "<kml xmlns=""http://earth.google.com/kml/2.0"">"
Print #iFile, "<Document>"
Print #iFile, " <Folder>"
Print #iFile, " <name>QrySim</name>"
With MyRS
Do Until .EOF
Print #iFile, " <Placemark>"
strText = " <description><![CDATA[" & MyRS.Fields(1) & "]]></description>"
Print #iFile, strText
strText = " <name><![CDATA[" & MyRS.Fields(0) & "]]></name>"
Print #iFile, strText
Print #iFile, "<Point>"
strText = "<coordinates>" & MyRS.Fields(3) & "," & MyRS.Fields(2) & ",0</coordinates>"
Print #iFile, strText
Print #iFile, " </Point>"
Print #iFile, " </Placemark>"
.MoveNext
Loop
End With
Print #iFile, " </Folder>"
Print #iFile, " </Document>"
Print #iFile, "</kml>"
Close #iFile
MyRS.Close
Set MyRS = Nothing
Set MyDB = Nothing
'resest the recordset and database to blank
'launches google earth
Call Shell("explorer.exe " & "C:\Documents and Settings\ivantassev.UMC\Desktop\EXCELtoKML\DB\KMLIvan.kml", vbNormalFocus)
End Sub
admin
Posts: 4
Re: Access 2007 query conversion in .kml file and view in Google Earth
on: July 22, 2011, 21:43
Pages: [1]
Version: 1.0.31.3
;
Page loaded in: 0.05 seconds.