473,520 Members | 2,786 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

syntax error in select query

44 New Member
sir,
suppose if the question is how many stations are there ,then if i give some word matching the question in table in the textbox named keyword ,i want to get that question
docmd.applyfilter "SELECT tblexam.* FROM tblexam WHERE tblexam.question like ' * '" & [Forms]![frmsetquestions]!keyword & "' * ' "
please help me
thanks in advance
May 10 '07 #1
9 2239
kepston
97 Recognized Expert New Member
sir,
suppose if the question is how many stations are there ,then if i give some word matching the question in table in the textbox named keyword ,i want to get that question
docmd.applyfilter "SELECT tblexam.* FROM tblexam WHERE tblexam.question like ' * '" & [Forms]![frmsetquestions]!keyword & "' * ' "
please help me
thanks in advance
You appear to be misusing Applyfilter

Expand|Select|Wrap|Line Numbers
  1. DoCmd.ApplyFilter(Queryname)
or

Expand|Select|Wrap|Line Numbers
  1. DoCmd.ApplyFilter , "[question] like ' * '" & [Forms]![frmsetquestions]!keyword & "' * ' "
May 10 '07 #2
neelesh kumar
44 New Member
SrcSQL4 = "SELECT tblexam.* FROM tblexam WHERE tblexam.question like ' * '" & [Forms]![frmsetquestions]!keyword & "' * '"
DoCmd.ApplyFilter SrcSQL4
still giving syntax error.
please help me
May 10 '07 #3
kepston
97 Recognized Expert New Member
SrcSQL4 = "SELECT tblexam.* FROM tblexam WHERE tblexam.question like ' * '" & [Forms]![frmsetquestions]!keyword & "' * '"
DoCmd.ApplyFilter SrcSQL4
still giving syntax error.
please help me
You must use a SAVED query or just the WHERE clause (but without the WHERE keyword).
May 10 '07 #4
neelesh kumar
44 New Member
that query sntax is wrong sir
thats what i am asking.
please tell the correct query
May 10 '07 #5
kepston
97 Recognized Expert New Member
Try putting a semi-colon ; at the end of the statement within your quotes
May 10 '07 #6
JConsulting
603 Recognized Expert Contributor
that query sntax is wrong sir
thats what i am asking.
please tell the correct query

How about

Expand|Select|Wrap|Line Numbers
  1. "SELECT tblexam.*, tblexam.question FROM tblexam WHERE tblexam.question like * '" & [Forms]![frmsetquestions]!keyword & "'*;"
  2.  
May 10 '07 #7
neelesh kumar
44 New Member
sir,
i wrote what u told.
but still it is giving syntax error. My head is killing.
From 3days i am working on that query.
please help me.
what i tried is
SrcSQL4 = "SELECT tblexam.* FROM tblexam WHERE tblexam.question like * '" & [Forms]![frmsetquestions]!keyword & "'*;"
SrcSQL4 = "SELECT tblexam.* FROM tblexam WHERE tblexam.question like ' * '" & [Forms]![frmsetquestions]!keyword & "'* ';"
SrcSQL4 = "SELECT tblexam.* FROM tblexam WHERE tblexam.question like "* '" & [Forms]![frmsetquestions]!keyword & "'*";"
DoCmd.ApplyFilter (SrcSQL4)
with out semicolon at the end, also i tried all above
thanks in advance
May 11 '07 #8
kepston
97 Recognized Expert New Member
This works for me:
Expand|Select|Wrap|Line Numbers
  1. SrcSQL4 = "SELECT services.* FROM services WHERE services.[service performed] like '* " _
  2.         & [Forms]![services1]![keyword] & " *'"
  3. DoCmd.ApplyFilter SrcSQL4
  4.  
I created a new form in my database, pasted your code into it and changed table, field and form names.
No syntax error. The query did not find what I searched for, so I tidied up the spaces and quotes, and now it finds the word in the keyword textbox. I tried the filter on both a text field and a memo field with success.
I am using Access 2003, but I doubt that will affect it.
May 11 '07 #9
neelesh kumar
44 New Member
sir,
thank u very much for ur help.
i got it finally.
May 11 '07 #10

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

Similar topics

14
3057
by: sam | last post by:
When I run this SQL query: SELECT u.*, o.* FROM users u, orders o WHERE TO_DAYS(o.order_date) BETWEEN TO_DAYS('2003-09-20')-10 AND TO_DAYS('2003-09-20')+10
29
2477
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules" for when and how to use single quotes and double quotes in ASP? thanks! ---------------------- SQL = SQL & "WHERE '" &...
3
2527
by: JC-Atl | last post by:
I am trying to do this in the SQL page of phpMyAdmin, but I get a syntax error. Can someone please help me out ? Thanks for your time and efforts! JC INSERT INTO `Test` ( `pkey` , `col2` , `col3` ) VALUES ( SELECT max( `pkey` ) FROM Test, `rrrrrrrrr` , `wwwwwwwww` )
4
11316
by: deko | last post by:
I'm trying to update the address record of an existing record in my mdb with values from another existing record in the same table. In pseudo code it might look like this: UPDATE tblAddress SET AddressDescription of Entity 456 = AddressDescription of Entity_ID 123 Address1 of Entity 456 = Address1 of Entity_ID 123 City of Entity 456 =...
12
1674
by: Brad Baker | last post by:
I am trying to write a simple ASP.net/C# page which allows users to select some values and produce a report based on a SQL query. I have a self posting dropdown form which allows users to select the type of report to generate: Select the type of report to display: <form runat="server"> <asp:DropDownList AutoPostBack="true" ID="report"...
8
3157
by: p | last post by:
I'm trying to put a query into VBA code and its giving me difficulties. I would like to put the following query: SELECT tbl_Workload.Priority, tbl_Workload.Number AS Num, tbl_Workload.Name, tbl_Workload.Comment AS Comment, tbl_Workload.EmpID, tbl_Workload.TaskID, tbl_Jobs.ID FROM tbl_Workload LEFT JOIN tbl_Jobs ON tbl_Workload.Number =...
7
2869
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM", "OE_HDR"."SLS_MAN_NO", "OE_HDR"."SLS_MAN_INITIALS", "OE_HDR"."ORD_DAT", "OE_HDR"."SHIP_DAT" FROM "OE_HDR" WHERE ("OE_HDR"."ORD_NO"='174310') I...
2
2088
by: Sudhakar | last post by:
until i started using the techniques for avoiding sql injection, i have been using a normal insert and select sql query which worked fine. i have a registration page where a user enters their username and if this already exists i display a message by executing a select query and if the username does not exist then i run an insert query. ...
17
3109
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note that I am using Allen Browne's multi-select list box for a report as a guide. I should also note that my access skills are not the best so I may need...
7
2831
by: Yesurbius | last post by:
I am receiving the following error when attempting to run my query. In my mind - this error should not be happening - its a straight-forward query with a subquery. I am using Access 2003 with all the latest patches. If I do not group the query (ie. remove aggregation) it will work. If I recall, it also works if my subquery does not have...
0
7304
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7204
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...
1
7164
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...
0
7560
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...
0
4788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3282
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3280
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1646
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
1
837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.