0

I need help to write the code to filter a Recordset called Data1 and a Field called AWEIGHT, when loading a form. I tried the following and it does not work. After the form is opened I only want to be able to search the filtered records. An example would be nice.

Private Sub Form_Load()
Data1.Recordset.Filter = "AWEIGHT > 0"

End Sub

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by snurd
0

Well reading the help file on this it says that for better performance that you should use a query with a where clause...

so...

strSQL = "SELECT * FROM SomeTable WHERE SomeField = somevalue
Set Rs = Db.OpenRecordset(strSQL,...

Good Luck

0

I solved my problem by doing the following instead of using a filter.

Private Sub Form_Activate()
Data1.Recordset.MoveLast

If txtWeight > 0 Then
GoTo 2
End If
1
If txtWeight = 0 Then
Data1.Recordset.MovePrevious
GoTo 1
End If
Call Show
2
End Sub

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.