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
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