Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DAO/ADO Problem 1

Status
Not open for further replies.

Dodge

IS-IT--Management
Jun 14, 2001
25
0
0
US
Can somebody explain to me why I can never get DAO or ADO techniques to work. For example, I want to update a record using DAO, heres an example of what I did:

Dim dbs As Database
Dim rst As dao.Recordset
Dim sSelect As String

Set dbs = CurrentDb
Set rst = rs.openrecordset("select [Location2] from [dbo_Inv Master] WHERE [Inventory Part] ='" & PartStr & "'", dbOpendynaset)
With rst
.edit
![Location2] = "Changed"
.Update
End With
rst.Close

and here is the error I get:
"User defined type not defined" and It highlights:
Dim dbs as Database

I suppose I need to define it but where? I'm sure there is a simple reolution, just can't figure it out.
Can anybody help?

Thanks,
Dodge
 
In the VBE, go to tools, references, and check DAO 3.6 library. Use the arrows to move it up as far up the list as it will go.

-or-

Convert your code to ADO. Here is a sample of openiong a recordset.

Dim cnn as connection
Dim rst as New ADODB.Recordset
Set cnn = CurrentProject.Connection
Cnn Open."Provider = Microsoft.Jet.OLEDB 4.0; Source = "YourDatabase.mdb")
rst.Open "Table or Query or SQL",cnn. adopenStatic, adLockreadOnly



There's more info on my web page and here Tyrone Lumley
augerinn@gte.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top