View Single Post
  #4  
Old May 10th, 2007, 10:07 PM posted to microsoft.public.access.externaldata,microsoft.public.access.reports,microsoft.public.access
efandango
external usenet poster
 
Posts: 489
Default Creating a custom text export file (inc. header & footer) from

John,

thanks for your reply. I must confess it seems a little 'hardcore' for a
novice such as me. Can you walk me through the broad points of the syntax
used?


"John Nurick" wrote:

There are many ways of skinning this cat. I'd probably do something like
this (air code):

Dim rsR As DAO.Recordset
Dim strLine As String
Dim lngFN As Long

'Create empty text file
lngFN = FreeFile()
Open "D:\Folder\Addresses.kml" For Output As #lngFN

'Output header
'NB: need to double quotes in literal strings
Print #lngFN, "?xml version="1.0" encoding=""UTF-8""?"
Print #lngFN, "kml xmlns=""http://earth.google.com/kml/2.0"""
'...

'Output address
Set rsR = CurrentDB.Open("My Query")
Print #lngFN, rsR.Fields("kml Address")
Close rsR

'Output footer
Print #lngFN blah blah

Close #lngFN

On Thu, 10 May 2007 10:35:01 -0700, efandango
wrote:

I have an address query which ouputs a single field to text strings for
Google Earth .kml file format parameters.

The problem is that the .kml file requires a header and footer text to be
inserted. Does anyone know how I can pre-insert the Header and Footer into a
standard text file, and then save it with a ‘.kml’ extension, for example
‘Addresses.kml’

This is the Header:

?xml version="1.0" encoding="UTF-8"?
kml xmlns="http://earth.google.com/kml/2.0"
Document
nameAddress List/name
Folder
nameLocations/name
open1/open

Output Field: [kml Address]

This is the Footer:

/Folder
/Document
/kml


--
John Nurick [Microsoft Access MVP]

Please respond in the newsgroup and not by email.