Connecting Tech Pros Worldwide Help | Site Map

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

  #1  
Old August 18th, 2008, 10:35 PM
Karl
Guest
 
Posts: n/a
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>


  #2  
Old August 19th, 2008, 12:55 AM
lyle fairfield
Guest
 
Posts: n/a

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


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"
Quote:
>
</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" <someone@sbcglobal.bizwrote in
news:KTlqk.34838$co7.33830@nlpi066.nbdc.sbc.com:
Quote:
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>
>
>
>
  #3  
Old August 19th, 2008, 03:35 PM
rkc
Guest
 
Posts: n/a

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


On Aug 18, 5:41 pm, "Karl" <some...@sbcglobal.bizwrote:
Quote:
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

  #4  
Old August 19th, 2008, 06:25 PM
lyle fairfield
Guest
 
Posts: n/a

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


You read the question before you answered!
Is that fair?

On Aug 19, 10:33*am, rkc <r...@rkcny.comwrote:
Quote:
On Aug 18, 5:41 pm, "Karl" <some...@sbcglobal.bizwrote:
>
Quote:
Does anyone have a sample of an .hta file.
>
Quote:
I need to put Access data in a local webpage. The data needs to be displayed
in an html table.(like a continous form)
>
Quote:
So far I have the following but don't know how to get the data on an html
table
>
Quote:
<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
  #5  
Old August 19th, 2008, 11:45 PM
rkc
Guest
 
Posts: n/a

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


On Aug 19, 1:17 pm, lyle fairfield <lyle.fairfi...@gmail.comwrote:
Quote:
You read the question before you answered!
Is that fair?
>
On Aug 19, 10:33 am, rkc <r...@rkcny.comwrote:
>
Quote:
On Aug 18, 5:41 pm, "Karl" <some...@sbcglobal.bizwrote:
>
Quote:
Quote:
Does anyone have a sample of an .hta file.
>
Quote:
Quote:
I need to put Access data in a local webpage. The data needs to be displayed
in an html table.(like a continous form)
>
Quote:
Quote:
So far I have the following but don't know how to get the data on an html
table
>
Quote:
Quote:
<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>
>
Quote:
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.
>
Quote:
Somewhere in your html: <div id="myContent"></div>
>
Quote:
code snippet:
>
Quote:
Dim sContent
Do Until rsData.EOF = True
'build html string
sContent = sContent & rs(0) & "<br>"
rsData.moveNext ' go to next record
>
Quote:
myContent.innerHTML = sContent
I guess I should have mentioned document.write("Awesome page
content.") also, but the
innerHTML thing is way cooler.
Closed Thread