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

Recordset filer

Status
Not open for further replies.

Kib

Programmer
May 17, 2001
58
US
Hi, been a long time since I had done anything in Access...I am trying to filter a recordset
here is what I have...surveys is a table in my database

Dim db as DAO.Database
Dim rs as DAO.Recordset
Dim strFILTER as String
Set db = CurrentDb
Set rs = CurrentDb.OpenRecordset("Surveys")
strFILTER = "Year=" & Forms!frmview!cmbYEAR & " AND Agency = " & Forms!frmview!cmbDEPT + 1
rs.Filter = strFILTER

although whenever it tries to do this...it tells me..."Operation is not supported for this type of object"

Like I said i havent done any of this stuff for years, and pretty much am starting from scratch, so I might be doing it completely wrong. Any help would be appreciated. Thanks!
 
The only thing I can see based on this information is that cmbDEPT may not be being interpreted as a numeric value. Most likely, you need to change the reference to cmbDEPT.Value. (I think VBA might be trying to add 1 to the control instead of to the control's value.)

Let me point out that setting the recordset's Filter property won't cause the recordset to become filtered. You have to set the Filter property, and then open another recordset using the first recordset's OpenRecordset method. The second recordset then has the filter applied. See the help file example for the Recordset.Filter property for an example.

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top