- vSearchString = SearchFor.Text
this will search all field data
but I need search column1 and column2 data only
Example column1 118 column2 22
text box entering only 118 22 - Code using:
-
-
Private Sub SearchFor_Change()
-
-
'Create a string (text) variable
-
Dim vSearchString As String
-
-
'Populate the string variable with the text entered in the Text Box SearchFor
-
'vSearchString = SearchFor.Text & "*"
-
-
vSearchString = SearchFor.Text
-
' vSearchString = "[PartNos] like " * " & txtBox & " * ""
-
-
'vSearchString = Len(Me!txtName.Text & "") <> 0
-
'btnNext.Enabled = Len(Me!txtName.Text & "") <> 0
-
-
-
'Pass the value contained in the string variable to the hidden text box SrchText,
-
'that is used as the sear4ch criteria for the Query QRY_SearchAll
-
SrchText.Value = vSearchString
-
-
'Requery the List Box to show the latest results for the text entered in Text Box SearchFor
-
Me.SearchResults.Requery
-
-
-
'Tests for a trailing space and exits the sub routine at this point
-
'so as to preserve the trailing space, which would be lost if focus was shifted from Text Box SearchFor
-
If Len(Me.SrchText) <> 0 And InStr(Len(SrchText), SrchText, " ", vbTextCompare) Then
-
Exit Sub
-
End If
-
-
'Set the focus on the first item in the list box
-
Me.SearchResults = Me.SearchResults.ItemData(1)
-
Me.SearchResults.SetFocus
-
-
'Requery the form to refresh the content of any unbound text box that might be feeding off the record source of the List Box
-
DoCmd.Requery
-
-
'Returns the cursor to the the end of the text in Text Box SearchFor
-
Me.SearchFor.SetFocus
-
-
If Not IsNull(Len(Me.SearchFor)) Then
-
Me.SearchFor.SelStart = Len(Me.SearchFor)
-
End If
-
-
-
End Sub
5 1607
oooppp,
Welcome to Bytes.
First, please use the Code Tags when posting code to the forum, as this is a requirement of the site. this is the [CODE/] button in your post editor. I have edited your post above.
Second, I am not sure exactly what your question is. You seem to be explaining what your code does, but have not asked a specific question. If you clarify, we would be glad to assist you.
I have text box called
SrchText
vSearchString = SearchFor.Text
I have Table1 field
ACnumber
PartNos
ACnumber 122
PartNos 28
etc..
I have to search this two numbers on SrchText
at present it shows all records when enter
instead 122 28
I have to enter in that search box 122 which is in one column
and 28 is another column so it will show both columns data only instead of all data
at present when I enter 122 in that search box it will show all data
My search Criteria
Like "*" & [forms]![FRM_SearchMulti]![SrchText] & "*"
hope its clear
Unfortunately it is still not clear.
I understand there may be a language barrier here--but I am still unclear what it is you want to do.
Try to be as specific as possible as to what you are looking for.
Thank you.
NeoPa 32,556
Expert Mod 16PB
Hi Twinny.
They want to search across two separate fields (columns) by entering the two items of numeric data into a single string control. Such items being separated by a space.
@Oooppp.
Is there a good reason you want to work this way? Under normal circumstances one would expect to enter the two field values in two separate controls on a form. To do it with a single control simply makes it more awkward to use for the operator and adds more work for you to code.
Almost everything is possible, even what you ask for here, but that doesn't mean everything is a good idea. This is a very long way from a good idea.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Richard |
last post by:
Hello everyone! Is it possible to create 2 columns of text
using XSL-FO and FOP (or any other XSL-FO to PDF generator)?
I want the function similar to 'fo:block' but in 2 columns,
so if the text...
|
by: jrs_14618 |
last post by:
Hello All,
This post is essentially a reply a previous post/thread
here on this mailing.database.myodbc group titled:
MySQL 4.0, FULL-TEXT Indexing and Search Arabic Data, Unicode
I was...
|
by: christine0207 |
last post by:
Hi,
how to generate a fixed length data text file using Scripting.TextStream / filesystemobject.
|
by: Tequilaman |
last post by:
Hi everybody!
I want to search some data string of 3 to 11 characters within a hich number of files. tese files are text files with names that are not .txt but .10F etc. All are in one ffolder,...
|
by: 848lu |
last post by:
hi, im trying to do a search on my Array, where a users searches on a HTML screen and then the PHP searches the array for the data under the roice entred by user.....text file data is under the php...
|
by: MiziaQ |
last post by:
How can I delete a row of data from a data/text file in vb6 ? I am using an MSFlexGrid, so the user can select which row is to be deleted.
Thanks in advance,
MiziaQ
|
by: shane12345 |
last post by:
i hav a text file anagrams.text.......and i hav a 2d array r....i want to search in the text file anagrams.txt the words present in the 2d array and if present print them....thanx....(im trying to...
|
by: Alex T |
last post by:
Hello, I have a bit of a problem here: I am trying to make the search find the positions of a string in the text file.
The .txt file is very large and the string comes up multiple times, so I need...
|
by: sanskruti |
last post by:
Help me..
im doing project on autobizz where i need to track the order and display the dept name where it is currently present..
while executing these codes, i found an error saying : After end...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |