VB6 DHTML - Expamples and help please!

hey yer barred

Board Regular
Joined
Jun 19, 2007
Messages
232
Hi All

I've been google-ing for well over a hour now and have found nothing to help me.

I've been using VB6 now for well over 3 years and never ever used the DHTML enviorment, and being as i have some time....im going to have a gander at it!

I have a select box that i have no idea how to add items to it from a recordset. Normally i would do this

If not(rs.eof) then
do while (not(rs.eof))
me.list1.additem = rs!Name
rs.movenext
loop
end if

This doesnt work on the html select box...can anyone help me please?

Also, can someone please post some likes to any good tutrials for this.

Your help is appresicated!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
You have to either declare the variables and assign their values, or just use the values - so instead of adLockOptimistic you would put 3.
 
Upvote 0
sorry to bring this up again....im having a problem with my SQL statement, very simple query

rs.open "SELECT * FROM tblName"

it wont run, anyone got anyideas?
 
Upvote 0
You seem to be missing the connection part of that, or have you set it elsewhere?
 
Upvote 0
heres my code, i should have just posteed this in the first place!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<HEAD>
<TITLE>VB6 Test HTML</TITLE>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<script language="VBScript">

sub TestDBConnect
Dim db
Dim rs
set db = CreateObject("ADODB.Connection")
set rs = CreateObject("ADODB.Recordset")

sPath = App.Path & "\TestDB.mdb"
sconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sPath
db.ConnectionString = sconn
db.Open

rs.ActiveConnection = db
rs.LockType = 3
rs.CursorType = 1
rs.Open "SELECT * FROM tblManager"

msgbox rs!Name
rs.close
db.close
End sub

</script>

<META content="MSHTML 6.00.2900.3268" name=GENERATOR>
</HEAD>
<BODY>
<INPUT onclick=TestDBConnect type="button" value="Button">
</BODY>
</html>
 
Upvote 0
You need to change this:
Code:
msgbox rs!Name
to this:
Code:
msgbox rs.Fields("Name")
or just:
Code:
msgbox rs("Name")
 
Upvote 0

Forum statistics

Threads
1,225,372
Messages
6,184,592
Members
453,246
Latest member
PEM000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top