String Search And Filter

Sep 11, 2006

I have been hunting around to find exactly what I need but cant seem to find it...

what I need is a way to do a string search within a particular field (surname) and then filter by that string?????

Any ideas or point me to the right thread will be much appreciated.

View Replies


ADVERTISEMENT

Modules & VBA :: Filter Records - Adding Unbound Date Listbox To Filter String

Feb 10, 2014

I'm trying to hash two scripts I've found into 1 functioning filter, however I'm still relatively new to vba and can't figure out how to get this working.

I'm trying to use Allen Browne's Search Criteria:

with another snippete of code I found here:

Code:
'Purpose: This module illustrates how to create a search form, _
where the user can enter as many or few criteria as they wish, _
and results are shown one per line.

[Code]....

It's the date part I'm having trouble with, the rest of the search criteria work fine without the date, but I can't get it working when I try to modify and merge the date sections of each code.

Also I'm using a listbox for the "Yesterday";"Last 4 days";"Last 9 days" and not a combo box.

View 2 Replies View Related

Search For A String Within A String

Oct 27, 2006

I have a column called CPU_S within a table called workstation that contains sample text like P111 933

I want to use the update command to search the CPU_S column for entries that contain this in there string then add P3 to a column called CPU_N

So far I have the code below but I don't know how to search a column entry for a specific string within a string. Can this be done and how?


UPDATE workstations SET CPU_N = "P4"
WHERE CPU_S = ;

View 3 Replies View Related

Search A String...

Mar 25, 2006

I'm trying to create a query that searches the string in a field, for a substring that the user specifies when the query is run. This is the SQL code:

SELECT tblStatement.Date, tblStatement.[Payment Type], tblStatement.Details, tblStatement.[Paid Out], tblStatement.[Paid In]
FROM tblStatement
WHERE (((tblStatement.Details) Like "**"))
ORDER BY tblStatement.Date;

between those two asterixes on the WHERE line, I'd like a string that the user has been prompted for. I've tried this:

WHERE (((tblStatement.Details) Like "*[Enter a String]*"))

But that fails to work, I guess because its in quotations. If I simply had Like [Enter a String], then I get the prompt, but I'll need to enter a string which exactly matches what I am looking for. In other words, I need a query which will search say, "abcdefg" for the user defined input: "abc", which will return that result. I just dont know how to get this to work :s

View 1 Replies View Related

Modules & VBA :: How To Add Check Box Values In To Filter String

Feb 2, 2014

I have got like subform which I think is the tech term I use it to filter dates on field "date raised" and open's a report depend on date's entered in txtstartdate and txtenddate it works perfectly but I need to add some check boxes to check other field's are true/false ...

Code:
Private Sub cmdPreview_Click()
Dim strReport As String
Dim strDateField As String
Dim strWhere As String
Dim lngView As Long

[Code] ....

I need to add code to the text in red well I'm guessing

here goes with what I would like to add
job cancelled1 check box name field name= job cancelled
job on hold1 check box name field name = job on hold
void property1 check box name field name = void property

E.g. if I put date range in my date boxes and tick job cancelled show all record in that date range cancelled same with job on hold and void property

here some code I did but wont work as it not in the same strwhere above

Code:
if me[job cancelled1] = true then
strwhere = [job cancelled] = 1 'field name
else
strwhere [job cancelled] is null
end if

Some how need to add the strwhere to the code above ...

View 8 Replies View Related

Search String For Space

Apr 11, 2006

I have a table containing names. Unfortunately, the first and middle name are in the same field, and not all have middle names. I need to separate them out in a report. Is it possible to search the field and break at the first space?

Any help would be greatly appreciated!
Thanks

View 1 Replies View Related

Reports :: Continuous Subform - Report Filter String

Nov 2, 2013

I have a command button as a field in a continuous subform which is based on a table. I click it and it opens a report. I need the report to be filtered by the ID of said record and not to show all the records.

View 3 Replies View Related

Add A Filter - Syntax Error In String In Query Expression

Mar 9, 2015

I'm experiencing a error when I go to add a filter, "Syntax error in string in query expression "MyFieldName""..If I go to to the table where the field is located, I CAN apply a filter.However, If I throw this single field on a form and switch to datasheet view, all of a sudden I can not filter it.

Additional info: whenever I go to build a query with the field, it throws brackets around this field and no others... this is weird.

Code:
SELECT MyTable.field1, MyTable.field2, MyTable.[problemfield]
FROM MyTable

View 5 Replies View Related

File Search To Return Path String

Apr 25, 2007

Hi, I have a command button that opens a pdf file. However i will be distributing the database as a runtime package and need to account for people having different versions of adobe reader so need to search for the filepath string where Acord32.exe is found. This is the code I have but I am stuck! Ay help aprpeciated!

Private Sub Command4_Click()

Dim stAppName As String
Dim stPathName As String
Dim fs As Object

Set fs = Application.FileSearch
With fs
.LookIn = "C:Program Files"
.SearchSubFolders = True
.FileName = "AcroRd32.exe"
.Execute
????? stAppName = .FoundFiles
Set fs = Nothing
End With

'specify path name for version of adobe acrord32.exe
'stAppName = "C:Program FilesAdobeReader 8.0ReaderAcroRd32.exe "
stPathName = GetIniSetting("C:WINDOWSSSI_DL3_PROGRS.ini", "DIR", "REPORT_FILELOCATION") & "HOOF.pdf"
Shell stAppName & stPathName, vbMaximizedFocus

End Sub

View 1 Replies View Related

VBA Code To Search And Replace When String Ends With A Value

Sep 11, 2012

I have the following in Column A

url.com?valueA
url.com?valueA&valueB
url.com?valueC

I need a function that

If string "ends with" valueA or ValueC, then replace it with ValueD

View 2 Replies View Related

Search Through All Access Queries For Text In SQL String

Feb 2, 2012

I need to find a way to search through all of the queries in my Access 2007 database to change the names of more than a few variables. There are close to 900 queries I need to search through many of which may use the variables as criteria, so if I miss even 1 instance I might screw myself completely.

I found this post and it tells me exactly what I need to do. Only problem is the post was written in 2002, and I've followed the below instructions only to have it not work.

As a contractor working predominantly on databases I haven't developed, it can be a daunting task trying to find references to tables, fields or functions within a list of several hundred queries.

The following code is attached to a command button on a simple form listing all queries in the database. The record source for the form is

SELECT DateCreate, Name FROM MSysobjects WHERE Type=5 ORDER BY DateCreate DESC

There is a text box where the user enters the text to search for. The code builds a table containing the SQL string of every query, then searches for the required text, and displays those that match.

Your form also needs a procedure the set the record source back to the default.

There are off-the-shelf applications such as Speed Ferret which perform this sort of function, however some employers are too cheap to purchase them!

Code:
sub cmdFilter_Click()
Dim db As Database
Dim rs As Recordset
Dim rsFilter As Recordset
Dim tdf As TableDef
Dim strSQL As String
Dim strQdf As String

On Error GoTo ErrorHandler

[Code] ....

View 11 Replies View Related

Replace New Lines After Search String With Corresponding Text With A Tab

Mar 25, 2014

I need to loop through text files and replace the new lines following the from, to, copy and subject fields with tabs and place the associated text on the same line as the from, to, copy and subject fields.

I start out with this. See below.

From:

ABC COrp@abc.com
To:
XYZ Inc.@xyz.com
Copy:

Me@abc.com; Myself@abc.com; Irene@xyz.com

Subject:

NOthing much

I need it to be like this.

From:ABC COrp@abc.com

To:XYZ Inc.@xyz.com
Copy:Me@abc.com; Myself@abc.com; Irene@xyz.com
Subject:NOthing much

How can I do this in access?

View 14 Replies View Related

Modules & VBA :: String And Date - Data Type Mismatched In Recordset Filter

Jan 10, 2015

I am trying to filter a recordset with a variable q. The field in the table associated with the record set is of data type Date/time. I assigned data types String and Date to q but both cases generates the error message " Data type mismatched in expression".

View 10 Replies View Related

Modules & VBA :: Database With Records - Search For Similar String

May 20, 2014

I am trying to write some code to search for similar strings. I am creating a database with records that all contain street addresses. These addresses may have more than one record attached to it, and we would like for folders to be created containing the records with similar street addresses. Problem is, all the existing records are from an excel spreadsheet that did not contain any data validation, so there are several instances of:

123 Street
123 st
123 street job 1
123 st job 2
etc....

So I am trying to write code to prevent this from happening in the future, by searching the database for a similar street address and asking the user if this is the address they are trying to enter. I have been trying to do this with the DLookUp function, as such:

Private Sub ProjectName_AfterUpdate()
Dim stLink, pName As String
pName = Me.ProjectName
stLink = DLookup("[ProjectName]", "tblMaster", "[ProjectName] LIKE '" & pName & "%'")
If IsNull(stLink) Or stLink = "" Then

[Code] ....

I have worded the stLink line different ways, and have used (*) instead of (%) but nothing is working. The CODE is working, as in no errors, but it is not finding a similar project that I know is present.

View 14 Replies View Related

Modules & VBA :: Edit A String Or Use Wildcard In Search Function

Jul 18, 2013

Access 2007

I can't figure out how to replace a period that is in the middle of a string and end up with 10 digits. For example 55.5555 would be 5500005555. I can use replace() but the tricky part is I have to end up with 10 digits.

Ultimately what I'm trying to do is - when a user enters 55.5555, 555.5, 5.5 or any variation they will be able to find the corresponding record. So a wildcard for the search or the replacement of the "." with enough zeros for 10 digits.

Here is what I'm using now - i making them enter the full 10 digit number but would like to give them the ability to use the period in place of the zeros.

Function Search()
Dim lssql As String
Dim lsSn As Recordset
Dim db As Database
Dim lsMessage As String
Dim sMsg As String
Dim vRetVal As Variant
Set db = CurrentDb()

[Code] .....

View 2 Replies View Related

Modules & VBA :: Insert CR / LF In Memo Field Based On Search String

Jan 16, 2014

I import a CSV field which has not preserved the CR/LF when it was exported from BCM Remedy. There is no setting for that. The memo field prints on my report like this:

A custom solution would be developed, that once implemented, could become the standard product in similar situation. Normally would assign to Network Engineering, but will work with Ray and the IPT Team to cost out the solution and get approval to proceed. 2012/05/24 10:44:28 AM PCOLLINS Sent to Ray Massie for review to determine if a solution needs to be proposed, or if they can wait for the National IPT solution to be ready in 2013.

I want to add VBA code that inserts a CR/LF in the memo field before all but the first occurance of a string that looks like a date, the first occurance doesn't need it. I will do it right after I import the CSV file into the table, so it happens only once, and it always prints and displays the CR/LF.

The memo field is called "NBS Update" and the table is called "CCRR Remedy Data"Here is what I have, but don't actually know what to put in to find the date and add a CR/LF:

Code:
Dim db As DAO.Database

Code:
Dim db As DAO.Recordset
Dim srtSQL As String

[code]...

View 14 Replies View Related

Queries :: String (via Non-visible Textbox) From Search Form As Criteria Using Checkboxes

Mar 11, 2014

I have an unbound form (named frmReportSearch) with unbound text & combo boxes providing the criteria for a query (named qSeqStreets). The form / query utilize 4 optional fields as search criteria plus date from / to. The results are returned via a report (named rptSeqStreets). The whole operation worked perfectly, however I realized I needed to change one of the criterion to a multivalued field. The change in the table (named Tasks) worked perfectly. I used three checkboxes (named chkA, chkB and chkC) to allow the user to select any combination of the 3 choices, including none (to be treated as no filter on [fldShifts]).

The three options in the field (named fldShifts) are "A" "B" and "C". I am able to manually run the query from design view by typing in the criteria "A" Or "B"... "A" Or "B" Or "C"... and any combination of the three options in the criteria box and running the query. I am using the following code under the OK button's OnClick. The Code below has other items related to all the options .... I didn't want to give partial code so you may understand better:

Code:
Private Sub btnOK_Click()
Dim strShift As String
Dim strA As String
Dim strB As String
Dim strC As String

[Code] .....

My problem is that the query criteria needs to be entered into the criteria box with quotes and separated by "Or" depending on if multiple checkboxes are selected.

I can get the results to show correctly in the textbox, however I imagine the query is adding an extra set of ""s to the string so rather than "A" Or "B" .. it is getting ""A" Or "B"". My query Sql and even design mode are pretty complex, so I wouldn't know how to use the sql in VBA without blowing some fuses.

View 1 Replies View Related

Filter Search

Mar 13, 2006

I want to add a filter search on my forum which will look up load numbers based on the selection from 3 other combo boxes. I already have two combo boxes; Customer & Load. When the user selects a customer the Load combo box grabs all load numbers from the database with this customer name. I would like to add two more filters, Part Number, and Date. The only problem is I don’t know how to set my load combo box to only select values based on the other 3 combo boxes (Date, Customer, and Part #). To clarify my question, please take a look at my database example.

View 2 Replies View Related

Search Filter

Jun 20, 2005

Hello all,

I using a cmbox for a search filter on a single form. The code that I'm using so far is....

Private Sub cmbCategory_AfterUpdate()
'Search filter for Category Combo box
Form_ClipsViewer.Form.Filter = "Category ='" & Me.cmbCategory & "'"
Form_ClipsViewer.Form.FilterOn = True

The code works great if there is a record for the category you choose, but if there isn't one it freezes up. I need to write some code that checks the records for this value before it executes. If there aren't any matches then it stops and brings up a msg box
Stating something like this

MsgBox "Sorry, there are no records for this Category", vbOKOnly, "Category Search"

Thanks,
Rich M.

View 2 Replies View Related

I Need Some Help On A Search/filter Form

Feb 27, 2008

Hi folks. I have started getting back into Access at work. It's been at least 3 or 4 years. The company I am building this db for is using '97.

I am trying to build a form with a search button and a text box to type a search string.
The form also has a subform which will display or filter the records based on the search criteria

I have tried to adapt "themightydude's" code to work, but i'm not getting anywhere...

I am truly trying to get back into the programming mindset, but have a "writer's block" at this moment.

I really want to understand how VB works. (& Sadly, I know it's one of the easiest languages to understand...)

here's what i have so far.

Private Sub Search_Click()

Dim GCriteria As String

If Len(cboSearchBy) = 0 Or IsNull(cboSearchBy) = True Then
MsgBox "You must select a field to search."

ElseIf Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
MsgBox "You must enter a search string."

Else

'Generate search criteria
GCriteria = cboSearchBy.Value & " LIKE '*" & txtSearchString & "*'"

'Filter frmCustomers based on search criteria
Form_GlobalSearch.GlobalSearchSub.Form.RecordSourc e = "select * from projects where " & GCriteria
Form_GlobalSearch.Caption = "projects (" & cboSearchBy.Value & " contains '*" & txtSearchString & "*')"

MsgBox "Results have been filtered."

End If

End Sub

I have also attached a picture of the search form and a copy of the db for reference.

Sorry, I know this code is probably WAY off. Any help is greatly appreciated.
Thank you all for your help!

View 2 Replies View Related

Search/filter Form

Feb 28, 2006

ok i would like to create a very specific search form. the form has many fields but they all belong to one simple table.. Enquiries.

i know this table isnt normalised but this section is separate from the database and i need this certain filter feature on the enquiry form i have made.

a screen of the form can be found here.

http://bb.1asphost.com/antonyx6/enqform.jpg

the top 3 combos contain all the records for that particular field.. the first bit of info i need is how to alter the statement for the combo lists to ignore values with no entries..this is because not every stored enquiry will contain an enquirer's forname.. is this correct for my Forname combo....?

SELECT zEnquiries.Enquiry_ID, zEnquiries.Enq_Forname FROM zEnquiries WHERE zEnquiries.Enq_Forname is NOT NULL;

i will take things one step at a time.. so if i can clear this up first i will describe what i want to happen next if thats ok..

thank you.

View 2 Replies View Related

Record Search, Not Filter

Nov 22, 2004

Hi,

I just want to create a search on my form where i input a date, and then press a command button that will jump to the first occurence of that date in the table. I don't want a filter, since that just excludes all the other data without that date. I tried playing around with FindRecord and GoToRecord, but to no avail, due to my limited knowledge. =P Thanks in advance.

G

View 1 Replies View Related

Search/filter Popup

Aug 11, 2007

i want to create a button that allows the user to search the db through the form,click the button textbox pops up and they enter the claim id they want to edit
i'm only really worried about searching the for the one field "claimid". can i do this in access?

View 5 Replies View Related

Modules & VBA :: Unable To Search A String Within Subform To Find Information Stored On Main Form

Dec 2, 2013

I'm trying to search a for string within a subform to find information stored on the mainform to which the particular subform belongs.

The problem is that the subform is generated from a query which uses a number from the main form to generate.

So the subform record is only generated when the correct mainform record associated with it is loaded.

Now to solve my problem I've made a new query that brings up ALL the results that could be generated by the main form and from that I can search to find my search term I'm after and read off the ID number to tie it back to the mainform.

But all of this is done manually, I want a way to do all this using VBA in a way that the user can't edit any records as they are doing it.

View 3 Replies View Related

Removing The Filter In A Search Form

May 25, 2006

Hi there, I currently have a search subform that will search for a specific record based on an ID or Name. However I do not want all the records to be filtered. I still want the user to be able to traverse through the other records.

Is there any way that I can disable the filtering?

thanks

View 1 Replies View Related

Forms :: Search And Filter Data Between Two Date Fields

Jul 29, 2013

I have a form in access where i need to select a record between two different dates. For example i have a "valid_from" and "valid_to" field. I have an unbound text box with short date format and calendar control inserted for users to select a date. This is named "drpdate".

I have a bunch of other filters also in the same form. Now my issue is that i have not been able to figure out how to put in a SQL statement which would give me the data which is between the "Valid_from" and "valid_to" fields based on the date selected in the unbound text box.

If the selected date does not meet the criteria, then it needs to be give the results from another table (which i have already done).

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved