473,652 Members | 3,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

query about search button in my form

44 New Member
sir,
i have a form exam created by using a table tblexam.In the tblexam fields are questionno,ques tion,option1,op tion2,option3,o ption4,answer fields.
In my form i have a question,option 1,option2,optio n3,option4 textboxes having control sources from tblexam .Along with search command button and 1 unbound text box named text20.
If i enter some word in that text box and then click search then i want to get all the records matching that word in the table in the form.
If Me!Text20.Value <> "" Then
Dim dbss As DAO.Database
Dim rsts As DAO.Recordset
Set dbss = CurrentDb
SrcSQL3 = "SELECT tblexam.* FROM tblexam WHERE like tblexam.* like text20& " * ""
Set rsts = CurrentDb.OpenR ecordset(SrcSQL 3, dbOpenSnapshot)
If rsts.BOF And rsts.EOF Then
MsgBox "Questions not found , Please Try Again."
Else
questionno.setf ocus
DoCmd.ApplyFilt er SrcSQL3
rsts.Close
dbss.Close
End If

my problem is with SrcSQL3 select query statement.
please help me.
how to write the query
May 8 '07 #1
5 2032
Rabbit
12,516 Recognized Expert Moderator MVP
A filter is only the WHERE clause of the SQL statement, without the word WHERE.
May 8 '07 #2
neelesh kumar
44 New Member
i want to get all the records matching the text typed in the textbox named text20(say) from the table tblexam.
docmd.applyfilt er SELECT tblexam.* FROM tblexam WHERE
please tell the WHERE condition
thanks in advance
May 9 '07 #3
Rabbit
12,516 Recognized Expert Moderator MVP
From the help files:

The ApplyFilter method carries out the ApplyFilter action in Visual Basic.

expression.Appl yFilter(FilterN ame, WhereCondition)

expression Required. An expression that returns one of the objects in the Applies To list.

FilterName Optional Variant. A string expression that's the valid name of a filter or query in the current database. When using this method to apply a server filter, the FilterName argument must be blank.

WhereCondition Optional Variant. A string expression that's a valid SQL WHERE clause without the word WHERE.
May 9 '07 #4
neelesh kumar
44 New Member
want to get all the records matching the text typed in the textbox named text20(say) from the table tblexam.
docmd.applyfilt er "SELECT tblexam.* FROM tblexam WHERE tblexam.questio n like ' "Forms!frmsetqu estions!text20 " ' "
with the above query i am not geting the required records.
suppose if the question is "what is speed" then in the textbox if i type speed i am not getting that question.If i give full question only in the textbox i am getting that record.
but i would like to give only some word in the question,i have to get the record.
please tell the WHERE condition how i have to modify
thanks in advance
May 9 '07 #5
Rabbit
12,516 Recognized Expert Moderator MVP
You're looking for wildcard characters.

From the help files:

? or _ (underscore) = Any single character
* or % = Zero or more characters
# = Any single digit (0— 9)
[charlist] = Any single character in charlist
[!charlist] = Any single character not in charlist
May 9 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5382
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says there is a sample file called Ixtrasp.asp, but I could not find it in my system although I installed indexing service. I followed the steps in MSDN site to create a basic .asp query form (too long to post it here), but it always displays: No...
4
6273
by: James | last post by:
Dear group, Can anyone tell me how to do the following? I have a basic list of numbers in a table I want to be able to search these by letting the user type "<10" or ">=50" on a simple form that has a list box showing the results I have tried creating a query that uses the criteria the user types on
2
2193
by: RBohannon | last post by:
I have a report with most fields populated by a query. However, some of the fields are variable in such a way that their values cannot be queried from a table. At present the values for these fields are being entered by the user as parameter values when the query is run. But there are four fields which need to be entered, and the pop-up dialog boxes can be annoying. I would like to have a form where the user can enter the data for...
6
7114
by: Andy | last post by:
Hello, I am having many problems with setting up a parameter query that searches by the criteria entered or returns all records if nothing is entered. I have designed an unbound form with 3 fields on it: Date (DateSpan1 and DateSpan2), Originator, and GroupName. I have added a button that triggers a query and uses those fields as its parameter criteria to populate a form. The user must be allowed to either enter all of the
3
1974
by: dskillingstad | last post by:
I'd appreciate any help I can get. I'm not sure what I'm doing wrong, but.... I've searched these groups for some solutions but no luck. I have an unbound form (frmSearch), with several unbound text boxes on it and a command button bound to a macro which fires off a parameter query based on the criteria/string that the user types into the text boxes on frmSearch. My goal is to create a search form where the user can search by any of...
3
4571
by: Jahangir | last post by:
Dear Fellows, I m in in Access VB, and working on a small project. Problem is that In main form (called search )I have made a textbox name text34, and a search button, which responsiblity is to open a form. I have made a query that show results which 'like Form.search.text34.text'. when i execut this query by double clicking its ask me to enter value of Form.search.text34.text and show correct results. On the same i made an other form...
10
6217
by: sesling | last post by:
I have created a query that will pull information from our database for the operators. This query will pull in on average 50,000 records. The operators need to refine the search results. I have used the following in the criteria section of the query for the operators to refine the search . However, the operators do not always remember how the clients name appears in the DB and we get several failed queries. To correct this, I created a form...
5
2017
by: deaconj999 | last post by:
Hi, I have nearly finished my database and I would like to add a query that uses a combo box to get the results, not the usual paramater style input. I suppose it would need a form and a query and a combo box, but where to start !!!!!!!! Any kind soul out there that can give me an example of where to start..........?
5
2060
by: huseyin | last post by:
Hello, I have two forms written mainly in php. Here how it functions currently: - First form has two submit buttons. - First submit button is a search button that submits a value of an input field that activates a database query and get the result - I control the length of the entered text with Java Script in the input field and activate the query without clicking the search button when a certain length is achieved - second submit...
16
7954
by: dougmeece | last post by:
Good day everyone, I have a database with 2 main forms. The first form is used to add records to the database and contains a command button that opens the 2nd form for records searching. On the second form I have tow combo boxes that I would like to search from. Currently, I just have the search button run a query which opens in a separate screen. This is the same for both combo boxes (they are independent of each other). I would like...
0
8279
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8703
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8589
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7302
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2703
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.