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

Type Mismatch error

Status
Not open for further replies.

chrislx

Programmer
Oct 17, 2003
32
0
0
US
I am trying to create a Query. The followings are the code.
I have got an error "Type mismatch" on
"Set rs = qdf.OpenRecordset(dbOpenDynaset)
I am not sure what is wrong? Appreciate any hints.

========== Code ===============
Dim db As Database
Dim rs As Recordset
Dim qdf As QueryDef
Dim strSQL As String
strSQL = "SELECT * FROM [Attribute-Codes] WHERE [Attribute-Codes].[Code-List-Name] = '" & Me.[Code-List-Name] & "'"

Set db = CurrentDb
Set qdf = db.CreateQueryDef("WhereUsed", strSQL)
Set rs = qdf.OpenRecordset(dbOpenDynaset)
Do While Not rs.EOF
MsgBox rs.Fields("Attribute_Name")
MsgBox rs.Fields("Class_Name")
rs.MoveNext
Loop

rs.Close
qdf.Close
db.Close
================================

Thanks again

chrislx
 
Try changing it to the following:

Code:
Set rs = db.OpenRecordset("WhereUsed", dbOpenDynaset)

This should do it for you.


Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top