Allen Browne Client Search Multiple Like Statements

Hi all,
I need to have this code search multiple fields, but I keep getting 
"Expected end of statement" on the Me in the second to last line:

If Not IsNull(Me.txtFilterMainName) Then
        'strWhere = strWhere & "([MainName] Like ""*" & Me.txtFilterMainName 
& "*"") AND "
         strWhere = strWhere & "([Address1] Like ""*" & Me.txtFilterMainName 
& "*"") OR " & _
            strWhere = strWhere & " ([StreetName] Like "" * " & 
Me.txtFilterMainName & " * "") Or "
            strWhere = strWhere & "([From] Like "" * " Me.txtFilterMainName 
& " * "") Or "
            strWhere = strWhere & "([To] Like "" * " & Me.txtFilterMainName 
& " * "") And "
    End If

Thanks,
NickX
0
Utf
3/19/2007 2:52:03 PM
access.forms 6864 articles. 2 followers. Follow

2 Replies
682 Views

Similar Articles

[PageSpeed] 57

You're missing an ampersand between "" * " and Me.txtFilterMainName

BTW, are those spaces actually in your code? If so, you won't find anything 
unless the value in the From field starts and ends with a space.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Nick X" <Nicknnator (no) @ (spam) aol.123com> wrote in message 
news:67A8B7F4-2741-4E04-86BC-094B56DA15F9@microsoft.com...
> Hi all,
> I need to have this code search multiple fields, but I keep getting
> "Expected end of statement" on the Me in the second to last line:
>
> If Not IsNull(Me.txtFilterMainName) Then
>        'strWhere = strWhere & "([MainName] Like ""*" & 
> Me.txtFilterMainName
> & "*"") AND "
>         strWhere = strWhere & "([Address1] Like ""*" & 
> Me.txtFilterMainName
> & "*"") OR " & _
>            strWhere = strWhere & " ([StreetName] Like "" * " &
> Me.txtFilterMainName & " * "") Or "
>            strWhere = strWhere & "([From] Like "" * " Me.txtFilterMainName
> & " * "") Or "
>            strWhere = strWhere & "([To] Like "" * " & Me.txtFilterMainName
> & " * "") And "
>    End If
>
> Thanks,
> NickX 


0
Douglas
3/19/2007 2:59:56 PM
It is usually the obvious ones that give you the isn't it?!? 
Thank you very much, Douglas, I would have stared at that for hours and 
still probably not seen it.
Agian, Thanks;
NickX

"Douglas J. Steele" wrote:

> You're missing an ampersand between "" * " and Me.txtFilterMainName
> 
> BTW, are those spaces actually in your code? If so, you won't find anything 
> unless the value in the From field starts and ends with a space.
> 
> -- 
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
> 
> 
> "Nick X" <Nicknnator (no) @ (spam) aol.123com> wrote in message 
> news:67A8B7F4-2741-4E04-86BC-094B56DA15F9@microsoft.com...
> > Hi all,
> > I need to have this code search multiple fields, but I keep getting
> > "Expected end of statement" on the Me in the second to last line:
> >
> > If Not IsNull(Me.txtFilterMainName) Then
> >        'strWhere = strWhere & "([MainName] Like ""*" & 
> > Me.txtFilterMainName
> > & "*"") AND "
> >         strWhere = strWhere & "([Address1] Like ""*" & 
> > Me.txtFilterMainName
> > & "*"") OR " & _
> >            strWhere = strWhere & " ([StreetName] Like "" * " &
> > Me.txtFilterMainName & " * "") Or "
> >            strWhere = strWhere & "([From] Like "" * " Me.txtFilterMainName
> > & " * "") Or "
> >            strWhere = strWhere & "([To] Like "" * " & Me.txtFilterMainName
> > & " * "") And "
> >    End If
> >
> > Thanks,
> > NickX 
> 
> 
> 
0
Utf
3/19/2007 3:33:55 PM
Reply:

Similar Artilces:

Selecting Multiple Cells.
I know how to select a range of cells by specifying reference in nam box. Examples: A10:A20 (The range of cells in column A and rows 10 through 20) 5:5 (All cells in row 5) However, I am attempting to select every third cell going down colum A, beginning with A3. I can enter A3, A6, A9 (This will select just those cells.) Is there a shortcut I can use to continue this pattern of every thir cell indefinitely? (I actually need to select every third cell down t A4950.) Thank you for any assistance -- Message posted from http://www.ExcelForum.com Here's one way: 1. Put this in ...

Replicate Windows Search
Hi When I play my music on the Turntable System I have it creates a copy with the extension OMX which makes my music files messy so I wrote a program to delete these. At the moment I run windows search to find all the ext OMX on all drives I then copy these to a temp folder and run my program to delete from that. This works fine but I wondered if it is possible to replicate the search on all Drives within VB? and store the results direct to the temp folder? I have tried google but so far did not find code to help me. Ron LondonLad wrote: > Hi > When I play my music o...

Figured out Search/Replace Problem
Thanks, anyway! ...

Help-Error validating multiple documents
Hello. I've got a total of 5 schemas. They are: 1 - 1.xsd - a description of a city 2 - 2.xsd - a description of a town 3 - CityHall.xsd - a description of a cityhall-meant to be part of a document based on 1.xsd in "user area". 4 - TownHall.xsd - a description of a townhall-meant to be part of a document based on 2.xsd in "user area". 5 - testmultischema.xsd - a document which combines in a batch instances of cities and towns based upon 1.xsd and 2.xsd. I get the following xml validation error: ERROR: The 'http://adamExt.org:TownHall' element is not declar...

Multiple Column Sorting
I've been reading online about sorting multiple columns and I'm confused. Selecting one column to sort also selects all the other columns as well, at least in Excel 2000 and XP. I didn't see any difference in selecting one column or using the "Then by" boxes, in fact, the "Then by" choices didn't work. If the first column sorted in ascending order, and I chose to sort the second and third columns to sort in descending order, Excel still sorted all three columns in ascending order. If Excel sorts the all the columns together by default, why use the "Then...

Multiple Products
Hi I would just like to ask if anyone is aware of whether or not you can add multiple line items when using the mail merge functionality in Version 4. Thanks Mark ...

Search/Extract Data w/in Text File
Hello again! I am searching within a text file for the last row within the file. After I locate the row I need to separate the data and place into multiple cells on my worksheet. The code I have is as follows: Dim TextPath As String Dim DelimSrchChar As String Dim METtime As String Dim DataBuffer As Variant Dim NCData As Variant Dim DelimPos As Integer '=============================================== DelimSrchChar = "," TextPath = "C:\Temp\Formatted_NC_SN1008.txt" Open TextPath For Input As #1 'open text file for SN1008 Do While Not EOF(1) ...

Multiple Spin-off
Hi, I have a question for how to create a transaction for a multiple spin-off. First, my set up, I'm using Microsoft Money 2007 deluxe and running Windows XP home edition. Tyco recently spun off two companies, Tyco Electronics [29.23%] and Covidien [31.75%], when I try to use the spin-off utility in Money it doesn't give me the option for multiple spin-offs. The first thing I tried was to perform one spin-off to a bogus name that combined the two companies [60.98%]. I was then going to spin the two companies off from the bogus company. However, that seamed to consume all the c...

Invoice or Statement with return stubs
We will be implementing lock box processing shortly, and so I want our customers to return a stub with every invoice or statement payment to clarify activity for the lock box preocessor. I've poked areound in the reports library and I haven't seen any report defs that say they have stubs. Seems like this isn't an odd need. Am I missing something, or do I need to build my own reports? tia Cindy You may be able to modify the report to include stubs, but it wont be very easy in RW. Your best bet would be to use Crystal, which could include an invoice on top and a summary on...

Help with If and Then statement
I have a form based on a query which is itself based on 2 tables tbllevy and tblindividual. The form has a control, txtpaidbybusiness, whose control source is a YES/NO field in tbllevy with the same name. The form has another control whose source is txtbusinessname in tbllevy. If txtpaidbybusiness is YES I want to populate the control txtbusinessname with the value of the field with the same name from tblindividual. The two tables are linked in the query by txtmemnumber.tblindividual and txtmemnbr.tbllevy Can someone help with the If Then statement I need to put in the AfterUpdate event...

Count rows based on multiple criteria
I have a need to count the number of rows in an Excel spreadsheet based on contents of multiple cells. The formula is on one worksheet and all data is on a second worksheet. IE: count all rows that have the word "Windows" in column B and the word "Complete" in column G. Have not been able to figure this out with common functions like count, countif, dcount, etc. Help appreciated. -- DMG IT Professional Search for SUMPRODUCT or SUMIFS if you use XL-2007 "dmg" wrote: > I have a need to count the number of rows in an Excel spreadshee...

Incident should be create automatically like c360 products
With any parameters or config, Incidents should be created automatically like EmailToCase c360 product. Thanks! ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=7b9224b9-28b...

span a table to multiple pages
Hi, I have a very long table with 300+ rows. Instead of adding a new table to every pages, is there a command to "span" the one table to multiple pages? Thanks! Not in Publisher. Publisher only allows 128 rows per page. Word has this capability. -- Mary Sauer http://msauer.mvps.org/ "Tom" <nospam@yahoo.com> wrote in message news:u1WmV9bHJHA.1940@TK2MSFTNGP03.phx.gbl... > Hi, > > I have a very long table with 300+ rows. Instead of adding a new table to > every pages, is there a command to "span" the one table to multiple pages? >...

Addition function of multiple cells
Does anyone know if there is a function that will take a list of numbers in different cells and run various addition combinations on the list to detemine which cells will add to a specific number? For example: A1 = 1 A2 = 2 A3 = 5 A4 = 7 I want to know which cells added to gether will give me 6...answer = A1 + A3 On Tue, 25 May 2010 11:11:01 -0700, DB74 <DB74@discussions.microsoft.com> wrote: >Does anyone know if there is a function that will take a list of numbers in >different cells and run various addition combinations on the list to detemine >which ce...

Pasting on multiple pages
This is probably a very simple problem to sort, but I've no idea where to start. I am creating a new publisher document with multiple pages (Y). I copy a group of objects from another publisher document (X) and paste them onto page 1 of Y. Then I open another publisher document (Z), copy a group of objects and paste them into page 2 of document Y. I go to page 1 to find the group from Z has replaced the orginal contents on from document X. Just as an example, I'd pasted 5 different groups of objects onto 5 different pages in one document, and then found that the most recent had...

Handling Multiple Marketing Lists
Hello; We are attempting to import mulitple marketing lists into CRM, and it would be *nice* to be able to keep each list seperate rather than importing them all into the Leads section as one big, monster pile ;D Is this possible? Has anyone figured-out a way to keep multiple marketing lists? Sincerely, Todd M. Taylor Sounds like you are simply trying to break them down. One example would be if you had multiple marketing campaigns. You want a way to show that each lead was assigned to each campaign. One way would be to add a drop down picklist with a list of campaigns etc so even though...

if statement question #2
How do I do this using an if statement in excel? If the amount is from 15000-350000 then the tax is .23, if its extactly 350000 then its .15 What I really need to know if theres something similar to "to" in the if statement. For example 15000 to 350000 like in a c++ switch statement. -- SMAlvarez ------------------------------------------------------------------------ SMAlvarez's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=33287 View this thread: http://www.excelforum.com/showthread.php?threadid=531129 Assuming there isn't more to it than...

searching information stores
I am looking for a tool that will search all mail messages in the information store. Is there something out there like this? My boss is asking. Thank you Quest has a tool to do this as does OnTrack. I believe Quest's solution is called Recovery Manager for Exchange and OnTrack's product is called PowerControls. NEMX software also has a product called PowerTools for Exchange - can't recall if this does the same thing or not, though. -- Ben Winzenz Exchange MVP "KatPavelka" <k.pavelka@comcast.net> wrote in message news:u3IZsLWNFHA.3192@TK2MSFTNGP10.ph...

Balance column in statements NEEDS to be a running balance!
We are using RMS Store Operations and have been haunted by the statement that comes standard with the software. Customers that really read their statements are completely dissatisfied with the way the balance column computes. Some customers have gone as far as refusing to pay off of them with out us re-printing their invoices and penciling in the correct amounts to prove the final balance... NO GOOD! The statement that I am referring to only occurs when we are using a revolving account type and the Radio Button for "Due after invoice date plus" is checked, we set ours for ...

Creating search folder
I am using Office 2003 Beta 2. I would like to create a dynamic search folder based on a variable search criteria. E.g. mail received in the last 2 weeks. The current implementation has build in 7 last days. Is there a way to build variable date based queries. e.g. find messages received betwen today - 1d and today - 2w. ? thanks ...

Search THIS Database
I am having a hard time finding questions I previously posted...is there a way to search for questions posted by a particular user? Also, is there a way to sort the search results based on the most recent to oldest? What are you using to read these posts? (I use Outlook Express, so how I search may not work for you.) Have you tried using on-line search tools ...? "PosseJohn" <PosseJohn@discussions.microsoft.com> wrote in message news:3ED9C2F5-A72B-4FAA-B7A3-599322D3B93C@microsoft.com... >I am having a hard time finding questions I previously posted...is ...

Multi term search in Business Contact Manager with outlook 93
I have set up the Business Contact Manager add-on with outlook 2003 to track information on trade services I use from home. Is it possible to do multi term searches. E.g. Builders located in London with fax numbers ...

Integration Manager to multiple companies
I am trying to determine if it is possible to create an integration using IM with e-connect adapter from one source (data file ) to multiple companies in Great Plains. Right now it is required to run the integration several times and sometimes errors (end user) occur. We are trying to avoid this situation. If anyone has suggestions I woudl appreciate it. -- Patti typically....NO There are a few master tables with triggers available so that records imported there can be copied to others...but only a few. -- Richard L. Whaley Author / Consultant / MVP 2006-2008 Documentation for So...

2-D charting with multiple rows
I have a power user who wishes to increase the size of his 2-D graphics but is limited to using 32000 records. He needs to be able to use 64,000 records. Any suggestions? I think this might be something that is changed in regedit but I am not sure. Thanks! Yep, and you can bypass the 256 column limit with Windows API calls. Joking aside, how about two series, formatted identically. If you have duplicate entries in the legend, select the legend, then select the text of one entry, and press the Delete key. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorial...

multiple conditional formats
How can I set up a worksheet for more than 3 conditional formats You can't. You would have to use a VBA macro to apply the formatting, which would be static and not change with changes in the cell values -- you'd have to run the macro again. On Mon, 27 Sep 2004 18:57:03 -0700, "RC" <RC@discussions.microsoft.com> wrote: >How can I set up a worksheet for more than 3 conditional formats On Mon, 27 Sep 2004 18:57:03 -0700, "RC" <RC@discussions.microsoft.com> wrote: >How can I set up a worksheet for more than 3 conditional formats You can use ...