LIKE search help needed

1st Case Serial Number search works fine.
2nd Case Item Description Like search does not work. No compiling
error and no runtime error but search does not have result which I
know item is in the table.

Private Sub cboSearch_AfterUpdate()
    On Error Resume Next
    Dim strCriteria As String
    If Len(Me.txtSearch) > 0 Then
        Select Case cboSearch
            Case "Serial Number"
                strCriteria = "PODetail.SerialNumber = '" & txtSearch
& "'"
            Case "Item Description"
                strCriteria = "PODetail.ItemDescription = Like" & "*"
& txtSearch & "*"
        End Select
        Me.RecordsetClone.FindFirst (strCriteria)
        If Me.RecordsetClone.NoMatch Then
            MsgBox "No entry found", vbExclamation, "PO Track Search"
        Else
            Me.Bookmark = Me.RecordsetClone.Bookmark
        End If
   End If
    Me.txtSearch.SetFocus
End Sub
0
Song
6/4/2010 2:32:48 PM
access 16762 articles. 2 followers. Follow

4 Replies
1097 Views

Similar Articles

[PageSpeed] 55

On Fri, 4 Jun 2010 07:32:48 -0700 (PDT), Song <song.usa@gmail.com>
wrote:

You're missing a space and you have a spurius "=". It should be:
 strCriteria = "PODetail.ItemDescription Like *"
& txtSearch & "*"

-Tom.
Microsoft Access MVP



>1st Case Serial Number search works fine.
>2nd Case Item Description Like search does not work. No compiling
>error and no runtime error but search does not have result which I
>know item is in the table.
>
>Private Sub cboSearch_AfterUpdate()
>    On Error Resume Next
>    Dim strCriteria As String
>    If Len(Me.txtSearch) > 0 Then
>        Select Case cboSearch
>            Case "Serial Number"
>                strCriteria = "PODetail.SerialNumber = '" & txtSearch
>& "'"
>            Case "Item Description"
>                strCriteria = "PODetail.ItemDescription = Like" & "*"
>& txtSearch & "*"
>        End Select
>        Me.RecordsetClone.FindFirst (strCriteria)
>        If Me.RecordsetClone.NoMatch Then
>            MsgBox "No entry found", vbExclamation, "PO Track Search"
>        Else
>            Me.Bookmark = Me.RecordsetClone.Bookmark
>        End If
>   End If
>    Me.txtSearch.SetFocus
>End Sub
0
Tom
6/4/2010 2:56:22 PM
Thank you for fast reply. I changed the code but it still has no
result.

strCriteria =3D "PODetail.ItemDescription Like *" & txtSearch & "*"


On Jun 4, 7:56=A0am, Tom van Stiphout <tom7744.no.s...@cox.net> wrote:
> On Fri, 4 Jun 2010 07:32:48 -0700 (PDT), Song <song....@gmail.com>
> wrote:
>
> You're missing a space and you have a spurius "=3D". It should be:
> =A0strCriteria =3D "PODetail.ItemDescription Like *"
> & txtSearch & "*"
>
> -Tom.
> Microsoft Access MVP
>
>
>
> >1st Case Serial Number search works fine.
> >2nd Case Item Description Like search does not work. No compiling
> >error and no runtime error but search does not have result which I
> >know item is in the table.
>
> >Private Sub cboSearch_AfterUpdate()
> > =A0 =A0On Error Resume Next
> > =A0 =A0Dim strCriteria As String
> > =A0 =A0If Len(Me.txtSearch) > 0 Then
> > =A0 =A0 =A0 =A0Select Case cboSearch
> > =A0 =A0 =A0 =A0 =A0 =A0Case "Serial Number"
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0strCriteria =3D "PODetail.SerialNumber =
=3D '" & txtSearch
> >& "'"
> > =A0 =A0 =A0 =A0 =A0 =A0Case "Item Description"
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0strCriteria =3D "PODetail.ItemDescriptio=
n =3D Like" & "*"
> >& txtSearch & "*"
> > =A0 =A0 =A0 =A0End Select
> > =A0 =A0 =A0 =A0Me.RecordsetClone.FindFirst (strCriteria)
> > =A0 =A0 =A0 =A0If Me.RecordsetClone.NoMatch Then
> > =A0 =A0 =A0 =A0 =A0 =A0MsgBox "No entry found", vbExclamation, "PO Trac=
k Search"
> > =A0 =A0 =A0 =A0Else
> > =A0 =A0 =A0 =A0 =A0 =A0Me.Bookmark =3D Me.RecordsetClone.Bookmark
> > =A0 =A0 =A0 =A0End If
> > =A0 End If
> > =A0 =A0Me.txtSearch.SetFocus
> >End Sub- Hide quoted text -
>
> - Show quoted text -

0
Song
6/4/2010 3:15:07 PM
You need to wrap the pattern string in literal quotes characters:

strCriteria = "PODetail.ItemDescription Like ""*" & txtSearch & "*"""

A pair of contiguous quotes characters within a string expression is
interpreted as a literal quotes character.

Ken Sheridan
Stafford, England

Song wrote:
>Thank you for fast reply. I changed the code but it still has no
>result.
>
>strCriteria = "PODetail.ItemDescription Like *" & txtSearch & "*"
>
>> You're missing a space and you have a spurius "=". It should be:
>>  strCriteria = "PODetail.ItemDescription Like *"
>[quoted text clipped - 31 lines]
>>
>> - Show quoted text -

-- 
Message posted via http://www.accessmonster.com

0
KenSheridan
6/4/2010 3:43:10 PM
On Jun 4, 8:43=A0am, "KenSheridan via AccessMonster.com" <u51882@uwe>
wrote:
> You need to wrap the pattern string in literal quotes characters:
>
> strCriteria =3D "PODetail.ItemDescription Like ""*" & txtSearch & "*"""
>
> A pair of contiguous quotes characters within a string expression is
> interpreted as a literal quotes character.
>
> Ken Sheridan
> Stafford, England
>
> Song wrote:
> >Thank you for fast reply. I changed the code but it still has no
> >result.
>
> >strCriteria =3D "PODetail.ItemDescription Like *" & txtSearch & "*"
>
> >> You're missing a space and you have a spurius "=3D". It should be:
> >> =A0strCriteria =3D "PODetail.ItemDescription Like *"
> >[quoted text clipped - 31 lines]
>
> >> - Show quoted text -
>
> --
> Message posted viahttp://www.accessmonster.com

Thanks. strCriteria =3D "PODetail.ItemDescription Like ""*" & txtSearch
& "*"""
works perfect!
0
Song
6/4/2010 3:52:09 PM
Reply:

Similar Artilces:

array frequency data search
Hi. I need to list, in order of frequency, the five most frequently occurring numbers from a cell series (say A1:J10). I have been stumped for weeks on this. I need Most frequently-occurring number Next most-frequently number etc (all the way to, say the fifth-most-frequently occurring number). I can used =mode(a1:J10) to find the most frequently-occurring number - but then I am lost. Can someone help? It looks simple ... but it's beaten me. On Sun, 10 Jan 2010 14:34:01 -0800, bishee <bishee@discussions.microsoft.com> wrote: >Hi. > >I need to ...

sumifs multiple columns help
Excel 2007- I cannot get my sumifs formula to work. If I just have the sumrange one column of data it works perfect, but I need it to sum multiple columns. Here is my current formula: =SUMIFS('Original Data'!$C$2:$C$46668,'Original Data'!$A$2:$A$46668,$A3,'Original Data'!$B$2:$B$46668,B$1) I need the first part to read 'Original Data'!$C$2:$N$46668 so it goes from column C to column N instead of just column C. But when I do this I get a #Value error. It works just fine when I just have column C as the sumrange but I need C thru N. Hi, Tr...

I would like to
I would like to have the Sales rep printed on the receipt, how do I accomplish this? Craig, Download the Receipt - 40 column with Sales Rep from here; http://tinyurl.com/4gdbu You must have access to CustomerSource. -- * Get Secure! - www.microsoft.com/security You must be using Outlook Express or some other type of newsgroup reader to see and download the file attachment. If you are not using a reader, follow the link below to setup Outlook Express. Click on "Open with newsreader" under the MS Retail Management System on the right. http://tinyurl.com/75bgz ********** &qu...

Cell Change Color
Hi Bob, Thanks for the quick reply. I've tried it but it didn't work as expected or maybe i did something wrong. I've already click and paste the script as instructed but no change. I've attached a screenshot of what I intend to do. For column A will be the timer which will be updating according to my earlier description. Column B is the System name and column C is the Status which I need help. Thanks again Bob. -- alani Not sure Alani. Why don't you send me your workbook direct, and I will install it. -- HTH Bob Phillips "alani" <alani.1re19w@new...

Count help with numbering Rows?
In one row I have information. What I want to do is if there is information in that row I want excel to count. Say I have a range with 20 rows. In the first five rows there is no information but in the 6th row there is information. I want to assign the number 1 (This can be in a seperate column.) Then say there are 2 or 3 blank rows and another set of information comes up in that seperate column I want the number two to show up and so on. Here is my original formula but all I ever get is 1 and 2 even if multiply entrees. =count(offset(A1,0,0,Row(1:1) This formula is in a sep...

Show sum based on selection from Combo Box
I have a form, on the form there are 4 combo boxes for selection and the result are showed in a subform. I created a table (tblHours_worked) that contain the number of hours worked by each in employee. Now based on the selection from the combo box(s) how do I get the total hours worked to calculate and show in a field on the main form? Hopefully, this makes sense. -- tmdrake Add the textbox to the main form, I'm going to call it txtHourSum. For the control source for the txtHourSum put in something like this: =3DDSum("WorkHours","tblHours_worked", "Employ...

HELP Error: Trying to populate userform fields from access databas
Hi All, I have been struggling with this since long, I would appreciate if anyone can help me with getting this done. Basically I want to pull information from access database and populate my excel userform fields. For eg: If I input a Student Id field I want to populate the Name and Phone number for that student from access database, Here is the code that I have so far, But it gives me errors.. Please guide me through this Private Sub StudentId_AfterUpdate() Dim cnt As ADODB.Connection Dim rst As ADODB.Recordset Dim strSQL As String strSQL = "SELECT Name, Phone FROM...

Search / Replace Expressions Question
I am trying to replace spaces with tabs where the format is something like 12.2121 19.2141 12.2121 19.2141 and I can't just search on 5 spaces and replace with tab because there are other occurences of multiple spaces in the document so I need to pattern match. I got this far [0-9] [0-9][0-9].[0-9] but am not sure what to put in replace. I was hoping [0-9]^t[0-9][0-9].[0-9] meaning keep what was there but use tab instead which doesn't work. Pretty sure there was a way to say ok now that you found the pattern, just replace (this) Any help apprec...

Need your help
Hi there I need your help and expertise in this situation, please FieldA Estimation Existing tblA ResultA ResultA 21 021 021 021 36 024 24 024 18 012 12 012 775 307 307 307 A03 A03 A03 A03 6 006 006 006 0 000 000 000 2843 B1B B1B ...

Access 2000 query help (please!?)
Hi there guys, I am trying to devise a query and its just not coming to me. I'm hoping someone out there can help. I am trying to create a query that will give me the distinct value from two columns in the same table. Here is what its like: Table1: Schools Columns: school_id, school_abbrev, school_name Table2: Travel_Log Columns: log_to, log_from (these are numerics that tie to school_id above) So I want to create a list of all the schools visited in the travel log, so I want the distince values of log_to and log_from and then list them out with their abbreviations and full names i...

Missing import filter for Word! Like "WordPerfect 5.1 (UNIX)" ...
I'm missing much import filter on Office-Mac (specially WordPerfect 5.1 UNIX for Word.mac). Office 95/97/2000/XP for windows have much more useful import filter. Why all this filter are missing in Office.mac????? Or are all them included in an additional package????? Hi Dieter, This question has been answered over and over again in the Macintosh Word newsgroup. Take a gander in that newsgroup for your answer. Office does not ship with a converter because a converter has not been built that does a good job with converting. Details are here: http://www.mvps.org/word/FAQs/General/WordP...

Excel student needs help!!!!
Hi, I'm an excel student who is just learning the basics. I have an assignment to hand up that asks the following questions: 1 What are some of the limiatations of VLOOKUP in Excel? 2 Recommend some other opperations that could be automated by macros for this application (which was a workbook that recorded exam marks and overall grades for students) OR from your professional area(my major is graphic design). 3 Discuss the pros and cons of using password protection on spreadsheets in a business environment? I have found some answers to the first question on the internet, but am hav...

Help required with uploading a MS Publisher web site
I have read "Three top questions about publishing a Web site using Publisher 2003" but still can't upload my site. Using http://www.domain in the file name, prompts an attempt to contact server but it comes back with "Cannot find the URL 'http://www.domain ' please check your typing" What is going wrong? What should be in 'Publish to the Web' Dialog box 'Save In' field ? Publisher - Uploading http://msmvps.com/blogs/dbartosik/archive/category/1921.aspx -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://ms...

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 ...

Macro Help
I need a macro that will insert a number of rows based on the number of months between a start and end date and then copy the information in the above row to the new rows. The records are over 8,350.. so ill also need some idea how to get it to stop when it fills the worksheet so i can transfer those into another workbook What version of Excel are you using? "Katerinia" <Katerinia@discussions.microsoft.com> wrote in message news:394E5E6B-C761-4D83-87BC-B0A88AA41BAF@microsoft.com... >I need a macro > that will insert a number of rows > based on the...

Making Excel act like a database.
I need some help on a common problem in our company. We have several clients that we have agreed to do some Excel 2003 spreadsheets for. The spreadsheets analyze our performance for them. These spreadsheets follow a very specific formatting that the clients have gotten use to and are unwilling to change. When we have to update the spreadsheets once a month, it can take all day to do the updating for each client because we are currently using copy and paste to get the data in the right cells. I'll explain more in a second, but what I am hoping to find out from this posting is alternate...

time sheet help
I need to analyze the hours worked by employees on certain days off to determine how many hours, during what would be their normal shift time, that they actually worked. Here's how I have the columns: A= Time started, B= time finished, C= the total hours worked, D= normal shift time start, E= normal shift end time. If someone works from 3:00 AM (3:00) until 9:00 AM (9:00), leaves but is recalled at 2:00 PM (14:00) until 5:00 PM (17:00), and the normal shift time is 7:00 AM (7:00) until 3:PM (15:00), F= what formula will capture the hours worked between 7:00 AM and 3:00 PM? I wou...

newbie needs help - ACCESS - Word
Is it possible to import into a Word Table or Excel spreadsheet x number of records so that you could have on a page, like four photos across and several lines text fields underneath and then repeat the whole thing again, for a total of eight records on a given page? ...

COMBINING CELLS WITH LIKE DATA
I HAVE A SPREADSHEET TO TRACK INTERNAL MACHINING SCRAP SIMILAR TO THE ONE BELOW. I AM LOOKING FOR A WAY TO INSTANTANIOUSLY COMBINE ALL THE TOTALS FOR CUSTOMER A OR PART 13112 OR MACHINE B9 ON ANOTHER SPREADSHEET IF ANYONE KNOWS OF A WAY TO DO THIS PLEASE LET ME KNOW. THANKS. DATE CUSTOMER PART MACH # QTY TOTAL 8/9/2004 A 111 B9 2 13.46 8/9/2004 S 123 B9 4 26.92 6/4/2004 S 123 C14 5 31.95 6/1/2004 M 2131 C14 12 29.88 7/22/2004 B 13123 C3 1 0.75 7/5/2004 A 12312 C4 1 0.75 7/5/2004 ...

screen is showing slides in backward order .. . help!
Hello I have a pptx presentation with six slides. For some reason, everything is defualting the the right (the bullets come out to the right of the words, the slides print as handouts in backwards order, the outline pane is on the right hand side of the slide pane). THis is only happening for this presentation. Others I create are the typical way PP usually works. PLEASE HELP! I wish I could upload it here but am unable to do so. See your other post -- john ATSIGN PPTAlchemy.co.uk Free PPT Hints, Tips and Tutorials http://www.pptalchemy.co.uk/powerpoint_hints_and_t...

HELP PLEASE #6
I have a workbook that has seven worksheets "open", "closed", "area1", "area2", "area3", "area4", "area5". On worksheet "open" each row will have a column range b2,b2000 labled "area" that I will be putting in one of the five areas (1-5). The "open" worksheet will also have another column range i2,i2000 listed as "active" which will have either a "y" or an "n". So this is what I need. 1. I need the entire row to copy and paste over to the corresponding worksheet ...

My Headers are Spam Like
I have an Exchange 5.5 server on NT domain, the headers on messages say: received from <machine name>.<domain name> which is SERVERA.COMPANYB, and some sites are rejecting our mail as spam. I think it's a dns problem because SERVERA.COMPANYB doesn't resolve to anything. Is there any way I can get a .COM into that header? dlw wrote: > I have an Exchange 5.5 server on NT domain, the headers on messages > say: received from <machine name>.<domain name> which is > SERVERA.COMPANYB, and some sites are rejecting our mail as spam. > I think it's a...

Search and Find Macro
I have an Excel2002 worksheet with several hundred entries (rows), each entry consists of several cells, the key cell entries being A = Ref Number; B = Work Item, C = Received Date and E = Deadline Date. I need to be able to search the list for those entries that contain a Deadline Date equal to or earlier than today�s date and have all the results listed in a separate tab, each result in the new worksheet (tab) to display the Ref Number, Work Item and Received Date. My limited knowledge tells me that this is too large a task for a normal formula function and may require a Macro to be written...

Pls Help Adding Time in mmm.ss format
Hi! i would appreciate any help on this as I have spent a great deal o time on this. I have a whole set of excel sheets with the followin information pertaining to audio files No Filename Duration The durations have all been entered as 1.29, 32.31, 102.11 etc with th number before the decimal point indicating the minutes and the numbe after the decimal point indicating seconds(all formatted as general which means that where the seconds is 20, it will display without th zero, such as 11.2, 10.3 etc) I need to total the duration column, with the final display als showing in this same fo...

Can I view image attachments in Outlook like they appear in Outlook Express?
Can I view image attachments in Outlook like they appear in Outlook Express, where they appear underneath the message body? Alternatively, can I "preview" them, rather than having to start up my image editing program just to see them? Thanks. No you can't view them inline. Have you tried changing the default program for opening images to your preview program so that it starts up automatically when you double click on an image attachment? "tasbill" <bill_griffin1@hotmail.com> wrote in message news:02c501c393c4$d8bc5480$a001280a@phx.gbl... > Can I view ima...