Need More Help with VB and Access

Byrd25
10-12-2004, 12:55 AM
So far I can get IE to see the heading but I can't get it to read the database and then output into the Table that I created what am I doing wrong. I have looked at many books and I saw a code just like this one in one of the books and it's not working. Please help!!!! :confused:


<PRE class=code><HTML>
<HEAD><TITLE>A Simple First Page</TITLE>
<SCRIPT LANGUAGE="VBScript">

<%

Dim myConnection
Dim strConnect

strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source= C:\Documents and Settings\default\My Documents\FooBar.mdb"


Set myConnection = CreateObject ("ADODB.Connection")
myConnection.Open strConnect
Set RS = CreateObject ("ADODB.Recordset")


RS.Open("Select * from tblFoo")
%>

</SCRIPT>
</HEAD>
<BODY>
</pre>
<TABLE align = center COLSPAN=8 CELLPADDING=5 Border=0 width=200&gt;<br>
<TR><TD VALIGN = TOP BGCOLOR ="#8000000" <FONT STYLE = "ARIAL NARROW" COLOR = "#ffffff"
size=2>id </font></td>
<TD VALIGN = TOP BGCOLOR ="#8000000"<FONT STYLE = "ARIAL NARROW" COLOR = "#ffffff"
size=2>fldMyVals </font></td>

<%
do while not RS.EOF %><TR>
<td bgcolor = "#8000000" ><font style = "arial narrow" size=2> <% RS ("id")%> </font><td>

<td align = center> <% RS ("fldMyVals") %> </td> </tr>

<% RS.MoveNext %>
<% Loop %>

</table>
</body>
</HTML>

MKoslof
10-12-2004, 07:10 PM
Within your Loop, what are you trying to do:

1) update existing records
2) delete existing records
3) assign these values to a specific controls, etc.

Byrd25
10-14-2004, 12:55 PM
Within your Loop, what are you trying to do:

1) update existing records
2) delete existing records
3) assign these values to a specific controls, etc.


What I am trying to do is write a VBScript that will retrieve values from a database and output the values in a command-line console. Since I am not familar with VBScript or retrieving data from MS Access using a program language, I read a couple of books and found one that had the following code above in hopes that it would work and of course it didn't. So now I am completely lost and can't seem to find any examples of VBScript and MS Access. CAn you help????

stillarookie
10-14-2004, 02:48 PM
Not real sure, haven't done a whole lot of this but maybe try this

<td align = center> <% RS.Fields("fldMyVals") %> </td> </tr>

HardCode
10-14-2004, 03:23 PM
Do you want to show the values in a web page or in a command window (console) ? Your first post shows HTML, but then you mention a console.

Byrd25
10-14-2004, 05:17 PM
Do you want to show the values in a web page or in a command window (console) ? Your first post shows HTML, but then you mention a console.
I need to show the values in command window but I don't know how. I haven't found any books that would show me the script for that. So that's why I am doing it in html so I can see the results in a web page. Where would I find info on how I can use VBScript in a command line??

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum