2 Replies - 2056 Views - Last Post: 03 December 2010 - 06:31 AM Rate Topic: -----

#1 Ding_nill  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 11-November 10

Filter with multiple column with one statement

Posted 01 December 2010 - 10:34 PM

Hi,

Could someone please tell me how do I combine the following two similar statement into one. They are similar in the sense that they both get input from the same textbox:

Me.ReportsQueryBindingSource.Filter = "ParkingSpaceID = '" & txtSearch.Text & "'"
Me.ReportsQueryBindingSource.Filter = "StudentID = '" & txtSearch.Text & "'"



I have tried couple :
Me.ReportsQueryBindingSource.Filter = "StudentID = '" & txtSearch.Text & "'" Or "ParkingSpaceID ='"& txtSearch.Text & "'"
Me.ReportsQueryBindingSource.Filter = "StudentID Or "ParkingSpaceID ='"& txtSearch.Text & "'"
......just none of them works...

I know there is one way to do it, coz I did it before. But just can't remember it.
Please help

Is This A Good Question/Topic? 0
  • +

Replies To: Filter with multiple column with one statement

#2 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1533
  • View blog
  • Posts: 4,913
  • Joined: 25-September 09

Re: Filter with multiple column with one statement

Posted 02 December 2010 - 05:35 AM

By hilighting .Filter and pressing F1 you should be able to display the help for that property. Here is what I found when I did it

Quote

' The Filter string can include Boolean expressions.
source1.Filter = "artist = 'Dave Matthews' OR cd = 'Tigerlily'"


So maybe try:
Me.ReportsQueryBindingSource.Filter = "ParkingSpaceID = '" & txtSearch.Text & "' OR StudentID = '" & txtSearch.Text & "'"

Was This Post Helpful? 0
  • +
  • -

#3 Ding_nill  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 11-November 10

Re: Filter with multiple column with one statement

Posted 03 December 2010 - 06:31 AM

Thanks to CharlieMay,

I have tried out your suggestion. However, it didn't work out. But I have come up with a 'by pass' solution.

Previously I generate a query to gather info from two tables. And then I try to do a filter through the query. And since the two tables have been combined into a query table, that is why i want to combine the filter statement.

So, now my solution is to go back to the two filter statements which get into from two different tables. (I have not much time left, I still have the time issue to solve)

Anyway, I will come back and post the combined query statement when I figure it out later.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1