by Zahid (7 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 5th June 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Create a HTML Report for VB, Run the Internet Explorer. this procedure call.
' you need one database for access.
dim cnn As New ADODB.Connection
Dim rss As New ADODB.Recordset
Dim Sql As String
Dim Account As New Collection
Dim vAccount As New Collection
Dim ViewAccount As Collection
Dim I, item
Dim FSo, Fil2, txtfile
Dim JFile
Dim No As String
Dim Name As String
vSql = " SELECT Inform.no, Inform.name From Inform ORDER BY Inform.no"
cnn.Open "Information"
rss.Open Sql, cnn, adOpenDynamic, adLockOptimistic
While rss.EOF <> True
No = rss("no")
Name = rss("name")
Set Discrete = New Collection
Discrete.Add No, Key:="No"
Discrete.Add Name, Key:="Name"
Account.Add Discrete
Set Discrete = Nothing
rss.MoveNext
Wend
rss.Close
vAccount.Add Account, "Account"
Set ViewAccount = vAccount.item("Account")
cnn.Close
JFile = App.path & "\Reports\" & "USERINFO.HTM"
Set FSo = CreateObject("Scripting.FilesystemObject")
If FSo.FileExists(JFile) = True Then
Set Fil2 = FSo.GetFile(JFile)
Fil2.Delete
End If
Set txtfile = FSo.CreateTextFile(JFile, True)
txtfile.write ("<HTML>")
txtfile.writeblanklines (1)
txtfile.write ("<head>")
txtfile.writeblanklines (1)
txtfile.write ("<meta http-equiv=" & Chr(34) & "Content-Language" & Chr(34) & "content= " & Chr(34) & "en-us" & Chr(34) & ">")
txtfile.writeblanklines (1)
txtfile.write ("<meta http-equiv=" & Chr(34) & "Content-Type" & Chr(34) & "content=" & Chr(34) & "text/html; charset=windows-1252" & Chr(34) & ">")
txtfile.writeblanklines (1)
txtfile.write ("<meta name=" & Chr(34) & "GENERATOR" & Chr(34) & "content=" & Chr(34) & "Microsoft FrontPage 4.0" & Chr(34) & ">")
txtfile.writeblanklines (1)
txtfile.write ("<meta name=" & Chr(34) & "ProgId" & Chr(34) & "content=" & Chr(34) & "FrontPage.Editor.Document" & Chr(34) & ">")
txtfile.writeblanklines (1)
txtfile.write ("<title>User Information</title>")
txtfile.writeblanklines (1)
txtfile.write ("</head>")
txtfile.writeblanklines (1)
txtfile.write ("<body>")
txtfile.writeblanklines (1)
txtfile.write ("<p></p>")
txtfile.write ("<p align=" & Chr(34) & "center" & Chr(34) & "><b><font size=" & Chr(34) & "4" & Chr(34) & "><u>User Information</u></font></b></p>")
txtfile.write ("<p> </p>")
txtfile.write ("<p> </p>")
' Reports header print
txtfile.write ("<table border=" & Chr(34) & "0 " & Chr(34) & " cellspacing=" & Chr(34) & "1" & Chr(34) & " width=" & Chr(34) & "100%" & Chr(34) & ">")
txtfile.writeblanklines (1)
txtfile.write ("<tr>")
txtfile.writeblanklines (1)
txtfile.write ("<td width=" & Chr(34) & "20%" & Chr(34) & "><b><u><font size=" & Chr(34) & "2" & Chr(34) & ">No</font></u></b></td>")
txtfile.write ("<td width=" & Chr(34) & "60%" & Chr(34) & "><b><u><font size=" & Chr(34) & "2" & Chr(34) & ">Name</font></u></b></td>")
txtfile.write ("<td width=" & Chr(34) & "20%" & Chr(34) & "></td>")
txtfile.writeblanklines (1)
txtfile.write ("</tr>")
txtfile.write ("</table>")
txtfile.write ("<p> </p>")
For Each item In ViewAccount
txtfile.write ("<table border=" & Chr(34) & "0 " & Chr(34) & " cellspacing=" & Chr(34) & "1" & Chr(34) & " width=" & Chr(34) & "100%" & Chr(34) & ">")
txtfile.write ("<tr>")
txtfile.writeblanklines (1)
txtfile.write ("<td width=" & Chr(34) & "20%" & Chr(34) & "><font size=" & Chr(34) & "2" & Chr(34) & ">" & item("No") & "</font></td>")
txtfile.write ("<td width=" & Chr(34) & "60%" & Chr(34) & "><font size=" & Chr(34) & "2" & Chr(34) & ">" & item("Name") & "</font></td>")
txtfile.write ("<td width=" & Chr(34) & "20%" & Chr(34) & "></td>")
txtfile.writeblanklines (1)
txtfile.write ("</tr>")
txtfile.write ("</table>")
Next
txtfile.write ("</body>")
txtfile.writeblanklines (1)
txtfile.write ("</html>")
ShellExecute 0, "Open", JFile, 0, 0, SW_MAXIMIZE
Set Account = Nothing
Set vAccount = Nothing
Set ViewAccount = Nothing
Set JFile = Nothing
End Sub
No comments have been posted about Create a HTML Report for VB, Run the Internet Explorer. this procedure call.. Why not be the first to post a comment about Create a HTML Report for VB, Run the Internet Explorer. this procedure call..