I need to filter a form using the selection made by user from a dropdown.I have used the following code which throws an error: invalid argument
The error points to the code:
If I simply use
I am asked to enter a parameter value.
qryMIMATRIX is a query.I also tried using
If I do not use db.OpenRecordse t() then no filtering happens.
I would like to know how I can make this work?
Code:
Private Sub cboLocate_AfterUpdate() Dim rst As DAO.Recordset, db As Database Dim strCriteria, SQL As String strCriteria = "[A_LOCATION]=" & cboLocate Set rst = Me.RecordsetClone 'rst.FindFirst (strCriteria = "[A_LOCATE]=" & cboLocate) Set db = CurrentDb Set rst = db.OpenRecordset("qryMIMATRIX", dbOpenDynaset, dbReadOnly, dbOptimistic) If rst.NoMatch Then MsgBox "No entry found" Else Me.FilterOn = False Me.Filter = strCriteria Me.FilterOn = True End If End Sub
Code:
Set rst = db.OpenRecordset("qryMIMATRIX", dbOpenDynaset, dbReadOnly, dbOptimistic)
Code:
Set rst = db.OpenRecordset("qryMIMATRIX")
qryMIMATRIX is a query.I also tried using
Code:
Sql="select * from qryMIMATRIX" Set rst=db.OpenRecordset(SQL)
I would like to know how I can make this work?
Comment