what's wrong with this code

PedroSantos

New member
Local time
Today, 10:18
Joined
Feb 11, 2002
Messages
8
thanks.

Private Sub CC_AfterUpdate()
Dim db As Object
Dim rcdset As Recordset
Dim qdef As Object
Set db = CurrentDb
Set qdef = db.CreateQueryDef("Top_", "SELECT TOP 10 * FROM tops")
Set rcdset = qdef.OpenRecordSet()
Me.Recordset = rcdset
db.QueryDefs.Delete qdef.Name
End Sub
 
What error are you getting? What do you want the code to do? What version of Access are you using?
 
I have a listbox, and I want to create a query based on what I choose in the list box (although in the example it always creates the same query).
I'm receiving a type mismatch error, and i'm using access XP.
thanks.

Pedro Santos
 
Why not have a query and let the list box supply the criteria? [Forms]![YourFromName]![ListBoxName] in the Criteria field will filter the data based on your list box selection....
 

Users who are viewing this thread

Back
Top Bottom