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

Filtering a subform in datasheet view 1

Status
Not open for further replies.

Johnnycat1

Programmer
May 4, 2005
71
US
I am trying to filter the data in a subform based on a combo box "Combo16" in the main form. The code that I am using is:

DoCmd.ApplyFilter , "Forms!FrmBallastTracking!FrmBallastTrackingSubform![Project Name] = Forms!FrmBallastTracking![Combo16]"

The error that I get is that the form is not based on a table or query.

What am I doing wrong? Is there a simple way to filter a subform when the main form is not based on a query?
 
What about something like this ?
Code:
With Forms!FrmBallastTracking!FrmBallastTrackingSubform.Form
  .Filter = "[Project Name]='" & Forms!FrmBallastTracking![Combo16] & "'"
  .FilterOn = True
End With

If [Project Name] is defined as numeric in the subform's underlaying table/query then get rid of the single quotes.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top