Created
November 17, 2015 23:13
-
-
Save kissmygritts/b499d39b827472a71f58 to your computer and use it in GitHub Desktop.
.CSV output for all collar data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub csv_output() | |
Dim rs As DAO.Recordset | |
Dim sql As String | |
Dim fso As Object, csv As Object | |
Dim l As String | |
sql = "SELECT * FROM Query3" | |
Set rs = CurrentDb.OpenRecordset(sql) | |
Set fso = CreateObject("Scripting.FileSystemObject") | |
Set csv = fso.createtextfile("C:\Users\Mgritts\Documents\AllCollars.csv") | |
rs.MoveFirst | |
csv.writeline "locid, ndowid, timestamp, long_x, lat_y, hdop, species, mgmtarea, deviceid" | |
With rs | |
Do Until .EOF | |
l = !locid & "," & !ndowid & "," & !timestamp & "," & !long_x & "," & !lat_y & "," & !hdop & "," & !spid & "," & !mgmtarea & "," & !deviceid | |
csv.writeline l | |
.MoveNext | |
Loop | |
End With | |
rs.Close | |
csv.Close | |
Set fso = Nothing | |
Set csv = Nothing | |
Set rs = Nothing | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment