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!
Printable View
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!
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
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!
Select References from the Project menu.
Set a check mark on the Microsoft ActiveX Data Objects 2.x Library. Click OK, run your program.
-->cn.Privider = "Microsoft.Jet.OLEDB.4.0"
"Object doesnt support named arguments"
?? Huh??
Oops, that's just a typo.....change this:
cn.Privider = "Microsoft.Jet.OLEDB.4.0"
to this
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
More problems....
"ADO could not find the specified provider"
-->cn.Open "C:\ClientAlert\clients.mdb", "admin", ""
thankyou....