473,325 Members | 2,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

query about search button in my form

sir,
i have a form exam created by using a table tblexam.In the tblexam fields are questionno,question,option1,option2,option3,option 4,answer fields.
In my form i have a question,option1,option2,option3,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.OpenRecordset(SrcSQL3, dbOpenSnapshot)
If rsts.BOF And rsts.EOF Then
MsgBox "Questions not found , Please Try Again."
Else
questionno.setfocus
DoCmd.ApplyFilter 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 2008
Rabbit
12,516 Expert Mod 8TB
A filter is only the WHERE clause of the SQL statement, without the word WHERE.
May 8 '07 #2
i want to get all the records matching the text typed in the textbox named text20(say) from the table tblexam.
docmd.applyfilter SELECT tblexam.* FROM tblexam WHERE
please tell the WHERE condition
thanks in advance
May 9 '07 #3
Rabbit
12,516 Expert Mod 8TB
From the help files:

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

expression.ApplyFilter(FilterName, 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
want to get all the records matching the text typed in the textbox named text20(say) from the table tblexam.
docmd.applyfilter "SELECT tblexam.* FROM tblexam WHERE tblexam.question like ' "Forms!frmsetquestions!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 Expert Mod 8TB
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
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...
4
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...
2
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...
6
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...
3
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...
3
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...
10
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...
5
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...
5
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...
16
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.