Filter problem (1 Viewer)

LOUISBUHAGIAR54

Registered User.
Local time
Today, 14:16
Joined
Mar 14, 2010
Messages
157
I am working to filter a form using vba as follows.

filtru = ("[IDcardNo] = """ & numrukarta & """ And meta =Date()")

The above filter works perfectly well.

filtru = ("[IDcardNo] = """ & numrukarta & """ And meta =Date()-1 and [Roster] ='N' and [Finishtime] IS Null")

This second filter works perfectly well as well.

But when I join the two filters with OR (see below) the new filter fails. I get runtime error '13' Type mismatch.

filtru = ("[IDcardNo] = """ & numrukarta & """ And meta =Date()") Or ("[IDcardNo] = """ & numrukarta & """ And meta =Date()-1 and [Roster] ='O' and [Finishtime] IS Null")


Can someone please give me a lead on what could have gone wrong.

Many thanks and Happy Christmas and a Happy New Year.


Louis Buhagiar.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 07:16
Joined
Jan 20, 2009
Messages
12,852
The Or between the two parts needs to be in the string. Take out the double quotes on both sides of it.
 

LOUISBUHAGIAR54

Registered User.
Local time
Today, 14:16
Joined
Mar 14, 2010
Messages
157
Many thanks for your prompt answer. I removed the double quotation marks on each side of the OR and then started to get errors with extra (). So I removed these from either side of the OR clause and the filter is now working well.

However I now hope that the two parts of the string on each side of the OR are treated as a individual wholes on each side and not broken down in their respective parts.

Many thanks once again. Wonderful.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 07:16
Joined
Jan 20, 2009
Messages
12,852
Unless overridden by parentheses, AND is processed before OR.
 

Users who are viewing this thread

Top Bottom