If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > Filtering a subform with a combo box

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-25-10, 10:48
salconflu salconflu is offline
Registered User
 
Join Date: Jun 2010
Posts: 1
Filtering a subform with a combo box

I have been trying to adapt a method to filter a sub form on a tab page in my master form with a combo box that is also on the tab page (not the main form).

The subform lists all records for the field linking the subform to the master form but I want to filter these further by Species and Year;

Private Sub ComboFilterSpp_AfterUpdate()
Dim strwhere As String

If IsNull(Me.ComboFilterSpp) = False Then strwhere = "(Species = " &
Me.ComboFilterSpp & "')"
End If

If IsNull(Me.ComboFilterYear) = False Then

If strwhere < "" Then
strwhere = strwhere & " and "
End If

strwhere = "(Year = '" & Me.ComboFilterYear & "')"
End If

strwhere = "select * from Survey_Report_Query where " & strwhere

Me.Survey_Report_Query_SF.Form.RecordSource = strwhere

End Sub

My combo boxes are ComboFilterSpp and ComboFilterYear, my sub form is
Survey_Report_Query_SF and my underlying query is Survey_Report_Query.

For some reason I am getting a compile error "Method or data member not
found" when I call the subform.

I suspect I may also be having numerical data issues since the field I am filtering by has an underlying numerical value.

I would be greatly appreciative of any help you might give.
Reply With Quote
  #2 (permalink)  
Old 06-25-10, 10:56
NTC NTC is offline
Registered User
 
Join Date: Oct 2009
Posts: 340
IsNull(Me.ComboFilterSpp) = False

is incorrect syntax; should be:
IsNull(Me.ComboFilterSpp)

either it is or is not - no true or false
Reply With Quote
Reply

Tags
access, combo box, filters, subforms

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On