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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DAO-Type Mismatch

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

I'm trying to produce what should be fairly simple code on a MS Access '97 db. I have a table called Members and a form that creates a unique key from a combination of fields. Everytime I run the code, I get a 'type mismatch' error on the line that opens the recordset. The reference to the DAO 3.5 library has been set. Here is the code:

Dim db As Database
Dim rs As Recordset
Dim keycon As String
Dim tbl As TableDef



Set db = CurrentDb

Set rs = db.OpenRecordset("Members")

rs.MoveFirst

Do While Not rs.EOF
keycon = CStr(rs!Memind)
rs!State_Key = rs!Local_Name & keycon
Loop

rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
 
Do you mean you get an error on the line that says:
Code:
set rs=db.OpenRecordset("Members")

If so does it matter if you put in the default opentype of DbOpenDynaset? Are you sure you should be running DAO 3.5 library? Any chance that it could be DAO 3.61?

Hope this helps,
Rewdee
 
I figured out the problem in the interim. It did occur on the line you mentioned, however, what I needed to do was specify ...Dao.Recordset when I instantiated the object. weird

Thanks anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top