|
-
Apr 13th, 2000, 12:52 AM
#1
Thread Starter
Addicted Member
I Need to Open the DB "C:\Client.mdb"
In the "clients" table in the DB
there is a row called "Date"
I need to know how to copy the 1st record
of that row to a var...
Possable???
Thankyou!
-
Apr 13th, 2000, 01:03 AM
#2
You can do something like this. This example is using ADO, so make reference appropriately:
Code:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim dtDate As Date
cn.Privider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "C:\Client.mdb", "admin", ""
'Substitute MyDateField with the appropriate FieldName
'and MyTable with the appropriate TableName
rs.Open "Select Top 1 MyDateField From MyTable", cn, adOpenStatic
If Not rs.EOF Then dtDate = rs(0)
MsgBox dtDate
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
-
Apr 13th, 2000, 01:21 AM
#3
Thread Starter
Addicted Member
Dang..
Ya know.. I honestly dont know DBs that well
and when It gives me a error I cant tell whats
wrong.
It says I didnt define a Custom Type called
ADODB.Connection.. What can I do.??
Thankyou!
-
Apr 13th, 2000, 01:26 AM
#4
Select References from the Project menu.
Set a check mark on the Microsoft ActiveX Data Objects 2.x Library. Click OK, run your program.
-
Apr 13th, 2000, 01:33 AM
#5
Thread Starter
Addicted Member
-->cn.Privider = "Microsoft.Jet.OLEDB.4.0"
"Object doesnt support named arguments"
?? Huh??
-
Apr 13th, 2000, 01:45 AM
#6
Oops, that's just a typo.....change this:
cn.Privider = "Microsoft.Jet.OLEDB.4.0"
to this
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
-
Apr 13th, 2000, 02:23 AM
#7
Thread Starter
Addicted Member
More problems....
"ADO could not find the specified provider"
-->cn.Open "C:\ClientAlert\clients.mdb", "admin", ""
thankyou....
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
|