|
-
Oct 12th, 2000, 01:44 PM
#1
Thread Starter
Member
Greetings,
I have a Problem that is really nagging me. I have a VB app that is trying to get data in an Access 2000 .mdb
here is a code snippet
Code:
adoDriver = "Driver={Microsoft Access Driver (*.mdb)};"
adoPath = "dbq=" & DataBaseLocation & ";"
adouser = ";"
adoPassword = ""
Dim rs As ADODB.Recordset
' used temporarily until code is working
strConnection = adoDriver & adoPath & adouser & adoPassword
On Error GoTo handleErr
dbCheckOut.ConnectionString = strConnection
dbCheckOut.Open
cmCheckOut.ActiveConnection = dbCheckOut
cmCheckOut.CommandText = "select * from Machine"
rs = cmCheckOut.Execute
On Error GoTo 0
dbCheckout is the connection object
and cmCheckout is the command object
Both are declared public
The Problem is that the rs = mcCheckout.execute is saying invalid use of property and I have not clue as to why. I have looked in Technet and even downloaded a sample app from MS. And the sample code was "identical". And the references were nearly identical. Anyone have a clue as to why?
Thanks much
-=D=-
-
Oct 12th, 2000, 06:18 PM
#2
Addicted Member
what version of MDAC are u using?
if you've got 2.1 then you need to use 2.5 i guess because you're running Access 2000.
let me know if that works.
-
Oct 13th, 2000, 08:19 AM
#3
Thread Starter
Member
MDAC is not the problem... I don't recall what version i have, but I downloaded it of off MS about a month ago. So it is current.
Here is what the problem was, I'm Dumb :-)
The way that it needed to be done was this. I declared the database and connection object public. But that just make object set, It doesen't set it to anything.
In the Form, I needed to do this
Code:
public DBCheckout as adodb.connection
public CNCheckout as adodb.command
sub getdata
set dbCheckout = new adodb.connection
set cnCheckout = new adodb.command
end sub
So what it ammounts to is that I forgot the 'new' keyword. So Like I said, I'm Dumb :-)
Anyway, It works perfectly now
Thanks for Replying
-=D=-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|