how to access msaccess2000 by visual basic 6
how to access msaccess2000 by visual basic 6
(OP)
If I use the late binding then I don't need to use MDAC reference?
Is this the correct way of presenting it (do I have to use sub and end sub)?
CODE
Set cn = CreateObject("ADODB.Connection")
Quote:
Compile error:
Invalid outside procedure
Is this the correct way of presenting it (do I have to use sub and end sub)?
CODE
Dim connectionString As String
Dim query As String
Dim cn
Dim cmd
Dim rs
Set cn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
Set rs = CreateObject("ADODB.Recordset")
query = "SELECT text_data from bible"
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\wheelofgod\kjv.mdb;User Id=admin;Password=;"
cn.connectionString = connectionString
cn.Open
cmd.ActiveConnection = cn
cmd.CommandText = query
Set rs = cmd.Execute
While rs.EOF <> True
MsgBox (rs(0))
rs.MoveNext
Wend
rs.Close
cn.Close
Dim query As String
Dim cn
Dim cmd
Dim rs
Set cn = CreateObject("ADODB.Connection")
Set cmd = CreateObject("ADODB.Command")
Set rs = CreateObject("ADODB.Recordset")
query = "SELECT text_data from bible"
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\wheelofgod\kjv.mdb;User Id=admin;Password=;"
cn.connectionString = connectionString
cn.Open
cmd.ActiveConnection = cn
cmd.CommandText = query
Set rs = cmd.Execute
While rs.EOF <> True
MsgBox (rs(0))
rs.MoveNext
Wend
rs.Close
cn.Close
RE: how to access msaccess2000 by visual basic 6
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
RE: how to access msaccess2000 by visual basic 6
You should also include code to close the connections and release the objects before terminating the application.
Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
RE: how to access msaccess2000 by visual basic 6