virtualpete
Registered User.
- Local time
- Yesterday, 17:11
- Joined
- Aug 25, 2010
- Messages
- 21
Hi, I have a strange problem and cannot see why my script is not working properly.
Basically the scipt works and outputs the file but it misses paret of the data at the following line
' Write contents section
Do Until rstProp.EOF
WriteMapContents
rstProp.MoveNext
Loop
everything before and after writes to the file.
Here is my code if anyone would be so kind as to see where is might be going wrong:
Sub CreateHNNewMap()
'Declare variables
Dim db As Database ' Database
Dim strHTMLOut As String ' HTML output file name
' Open database and HTML & property recordset
Set db = DBEngine.Workspaces(0).Databases(0)
Set rstHTMLindex = db.OpenRecordset("Select * From tblHNNewSiteMap", dbOpenSnapshot)
Set rstProp = db.OpenRecordset("SELECT * FROM tblRentalProperties WHERE Active = 'Live' ORDER BY [Our ref];", dbOpenSnapshot)
Set rstProp10 = db.OpenRecordset("SELECT * FROM tblRentalProperties WHERE Active = 'Live' ORDER BY [Our ref];", dbOpenSnapshot)
' Open input & output files
strHTMLOut = HTMLDir & "NewMap.htm"
intFileOut = FreeFile() ' Get next file no.
Open strHTMLOut For Output As intFileOut ' Open output file
' Write file header
Temp = rstHTMLindex!html1
Print #intFileOut, Temp ' Write data line
' Write var positions section
Do Until rstProp.EOF
WriteHNNewMap
rstProp.MoveNext
Loop
' Write var positions end
Temp = rstHTMLindex!html2b
Print #intFileOut, Temp ' Write data line
' Write contents section
Do Until rstProp.EOF
WriteMapContents
rstProp.MoveNext
Loop
' Write footer
Temp = rstHTMLindex!html3
Print #intFileOut, Temp ' Write data line
' Tidy up
Close #intFileOut
rstProp.Close
db.Close
Set rstProp = Nothing
Set db = Nothing
End Sub
----------------------------------------------------------
Sub WriteHNNewMap()
Temp = rstHTMLindex!html2 & rstProp![Our Ref] & "," & rstProp![Lat:] & "," & rstProp![Long:] & rstHTMLindex!html2a
Print #intFileOut, Temp
End Sub
--------------------------------------------------------
Sub WriteMapContents()
Temp = rstHTMLindex!html2a & rstProp![Our Ref]
Print #intFileOut, Temp
End Sub
Mnay thanks in anticipation
Basically the scipt works and outputs the file but it misses paret of the data at the following line
' Write contents section
Do Until rstProp.EOF
WriteMapContents
rstProp.MoveNext
Loop
everything before and after writes to the file.
Here is my code if anyone would be so kind as to see where is might be going wrong:
Sub CreateHNNewMap()
'Declare variables
Dim db As Database ' Database
Dim strHTMLOut As String ' HTML output file name
' Open database and HTML & property recordset
Set db = DBEngine.Workspaces(0).Databases(0)
Set rstHTMLindex = db.OpenRecordset("Select * From tblHNNewSiteMap", dbOpenSnapshot)
Set rstProp = db.OpenRecordset("SELECT * FROM tblRentalProperties WHERE Active = 'Live' ORDER BY [Our ref];", dbOpenSnapshot)
Set rstProp10 = db.OpenRecordset("SELECT * FROM tblRentalProperties WHERE Active = 'Live' ORDER BY [Our ref];", dbOpenSnapshot)
' Open input & output files
strHTMLOut = HTMLDir & "NewMap.htm"
intFileOut = FreeFile() ' Get next file no.
Open strHTMLOut For Output As intFileOut ' Open output file
' Write file header
Temp = rstHTMLindex!html1
Print #intFileOut, Temp ' Write data line
' Write var positions section
Do Until rstProp.EOF
WriteHNNewMap
rstProp.MoveNext
Loop
' Write var positions end
Temp = rstHTMLindex!html2b
Print #intFileOut, Temp ' Write data line
' Write contents section
Do Until rstProp.EOF
WriteMapContents
rstProp.MoveNext
Loop
' Write footer
Temp = rstHTMLindex!html3
Print #intFileOut, Temp ' Write data line
' Tidy up
Close #intFileOut
rstProp.Close
db.Close
Set rstProp = Nothing
Set db = Nothing
End Sub
----------------------------------------------------------
Sub WriteHNNewMap()
Temp = rstHTMLindex!html2 & rstProp![Our Ref] & "," & rstProp![Lat:] & "," & rstProp![Long:] & rstHTMLindex!html2a
Print #intFileOut, Temp
End Sub
--------------------------------------------------------
Sub WriteMapContents()
Temp = rstHTMLindex!html2a & rstProp![Our Ref]
Print #intFileOut, Temp
End Sub
Mnay thanks in anticipation