469,356 Members | 2,460 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

How to create a .hta file (Access to local webpage)

Does anyone have a sample of an .hta file.

I need to put Access data in a local webpage. The data needs to be displayed
in an html table.(like a continous form)

So far I have the following but don't know how to get the data on an html
table

<html>
<head>
</head>
<Script Language="VBScript">
Dim conn
sub dotheconnection
Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\aqGuestSeating8\GuestSeatingSytem3.mdb"
If conn.errors.count <0 Then
alert("problem connecting to the database")
else
' if connected OK call sub getdata
getdata
end if
end sub
sub getdata
SQL_query = "SELECT * FROM tGuestsWaiting"
Set rsData = conn.Execute(SQL_query)
Do Until rsData.EOF = True
' need to display table of data here xxxxxxxxxxxxx
rsData.moveNext ' go to next record
Loop
end sub
</script>
<body>
Finished
</body>
</html>
Aug 18 '08 #1
4 9360
In the
<head>

put something like this:
<hta:application
id="executeSQL"
applicationname="Execute SQL"
border="dialog"
caption="yes"
icon="http://www.ffdba.com/images/sql.ico"
showintaskbar="yes"
singleinstance="yes"
sysmenu="yes"
>
</head>

see
http://msdn.microsoft.com/en-us/library/ms536496.aspx
for more info

name your file:
whatever.hta

HTA's are powerful. I use them from time to time. But, if all users have
Access available I use the MS Web Browser Control as I find it to be much
slicker.

"Karl" <so*****@sbcglobal.bizwrote in
news:KT*******************@nlpi066.nbdc.sbc.com:
Does anyone have a sample of an .hta file.

I need to put Access data in a local webpage. The data needs to be
displayed in an html table.(like a continous form)

So far I have the following but don't know how to get the data on an
html table

<html>
<head>
</head>
<Script Language="VBScript">
Dim conn
sub dotheconnection
Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\aqGuestSeating8\GuestSeatingSytem3.mdb"
If conn.errors.count <0 Then
alert("problem connecting to the database")
else
' if connected OK call sub getdata
getdata
end if
end sub
sub getdata
SQL_query = "SELECT * FROM tGuestsWaiting"
Set rsData = conn.Execute(SQL_query)
Do Until rsData.EOF = True
' need to display table of data here xxxxxxxxxxxxx
rsData.moveNext ' go to next record
Loop
end sub
</script>
<body>
Finished
</body>
</html>
Aug 18 '08 #2
rkc
On Aug 18, 5:41 pm, "Karl" <some...@sbcglobal.bizwrote:
Does anyone have a sample of an .hta file.

I need to put Access data in a local webpage. The data needs to be displayed
in an html table.(like a continous form)

So far I have the following but don't know how to get the data on an html
table

<html>
<head>
</head>
<Script Language="VBScript">
Dim conn
sub dotheconnection
Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\aqGuestSeating8\GuestSeatingSytem3.mdb"
If conn.errors.count <0 Then
alert("problem connecting to the database")
else
' if connected OK call sub getdata
getdata
end if
end sub
sub getdata
SQL_query = "SELECT * FROM tGuestsWaiting"
Set rsData = conn.Execute(SQL_query)
Do Until rsData.EOF = True
' need to display table of data here xxxxxxxxxxxxx
rsData.moveNext ' go to next record
Loop
end sub
</script>
<body>
Finished
</body>
</html>
If I understand the question, you have to build and html string in
your loop
and then set the innerHTML property of some element in your html to
the
string you end up with.

Somewhere in your html: <div id="myContent"></div>

code snippet:

Dim sContent
Do Until rsData.EOF = True
'build html string
sContent = sContent & rs(0) & "<br>"
rsData.moveNext ' go to next record

myContent.innerHTML = sContent

Aug 19 '08 #3
You read the question before you answered!
Is that fair?

On Aug 19, 10:33*am, rkc <r...@rkcny.comwrote:
On Aug 18, 5:41 pm, "Karl" <some...@sbcglobal.bizwrote:
Does anyone have a sample of an .hta file.
I need to put Access data in a local webpage. The data needs to be displayed
in an html table.(like a continous form)
So far I have the following but don't know how to get the data on an html
table
<html>
<head>
</head>
<Script Language="VBScript">
Dim conn
sub dotheconnection
Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\aqGuestSeating8\GuestSeatingSytem3.mdb"
If conn.errors.count <0 Then
alert("problem connecting to the database")
else
' if connected OK call sub getdata
getdata
end if
end sub
sub getdata
SQL_query = "SELECT * FROM tGuestsWaiting"
Set rsData = conn.Execute(SQL_query)
Do Until rsData.EOF = True
' need to display table of data here xxxxxxxxxxxxx
rsData.moveNext ' go to next record
Loop
end sub
</script>
<body>
Finished
</body>
</html>

If I understand the question, you have to build and html string in
your loop
and then set the innerHTML property of some element in your html to
the
string you end up with.

Somewhere in your html: *<div id="myContent"></div>

code snippet:

Dim sContent
Do Until rsData.EOF = True
* *'build html string
* *sContent = sContent & rs(0) & "<br>"
rsData.moveNext ' go to next record

myContent.innerHTML = sContent
Aug 19 '08 #4
rkc
On Aug 19, 1:17 pm, lyle fairfield <lyle.fairfi...@gmail.comwrote:
You read the question before you answered!
Is that fair?

On Aug 19, 10:33 am, rkc <r...@rkcny.comwrote:
On Aug 18, 5:41 pm, "Karl" <some...@sbcglobal.bizwrote:
Does anyone have a sample of an .hta file.
I need to put Access data in a local webpage. The data needs to be displayed
in an html table.(like a continous form)
So far I have the following but don't know how to get the data on an html
table
<html>
<head>
</head>
<Script Language="VBScript">
Dim conn
sub dotheconnection
Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=C:\aqGuestSeating8\GuestSeatingSytem3.mdb"
If conn.errors.count <0 Then
alert("problem connecting to the database")
else
' if connected OK call sub getdata
getdata
end if
end sub
sub getdata
SQL_query = "SELECT * FROM tGuestsWaiting"
Set rsData = conn.Execute(SQL_query)
Do Until rsData.EOF = True
' need to display table of data here xxxxxxxxxxxxx
rsData.moveNext ' go to next record
Loop
end sub
</script>
<body>
Finished
</body>
</html>
If I understand the question, you have to build and html string in
your loop
and then set the innerHTML property of some element in your html to
the
string you end up with.
Somewhere in your html: <div id="myContent"></div>
code snippet:
Dim sContent
Do Until rsData.EOF = True
'build html string
sContent = sContent & rs(0) & "<br>"
rsData.moveNext ' go to next record
myContent.innerHTML = sContent
I guess I should have mentioned document.write("Awesome page
content.") also, but the
innerHTML thing is way cooler.
Aug 19 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Petter Holmström | last post: by
13 posts views Thread by John Howard | last post: by
4 posts views Thread by Rene' Nielsen | last post: by
4 posts views Thread by Bnob | last post: by
1 post views Thread by Duffman | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.