473,382 Members | 1,225 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,382 software developers and data experts.

Where clause in SQL statement problem

I have an Access 97 database were I am opening a recordset in a module
referencing a control on a form. For some reason when the code executes I am
getting an error message stating missing operator and I am not sure why. The
code is as follows:

Public Sub Module1()
Dim rst as recordset

Set rst = CurrentDb.OpenRecordset("SELECT * From tblStores WHERE
tblStores.[STORENAME] = " & [Forms]![frmStoreForm]![STORENAME] & " ")

[STORENAME] is a text field which is why I delimited it with "

Am I missing something?

Any help would be appreciated.

Regards,
Mark
Nov 13 '05 #1
4 1762
On Wed, 9 Feb 2005 00:04:09 -0500, Giganews wrote:
I have an Access 97 database were I am opening a recordset in a module
referencing a control on a form. For some reason when the code executes I am
getting an error message stating missing operator and I am not sure why. The
code is as follows:

Public Sub Module1()
Dim rst as recordset

Set rst = CurrentDb.OpenRecordset("SELECT * From tblStores WHERE
tblStores.[STORENAME] = " & [Forms]![frmStoreForm]![STORENAME] & " ")

[STORENAME] is a text field which is why I delimited it with "

Am I missing something?

Any help would be appreciated.

Regards,
Mark


WHERE tblStores.[STORENAME] = '" & [Forms]![frmStoreForm]![STORENAME]
& "'"

Flor clarity, the quotes are like this:
= ' " & [Forms]![frmStoreForm]![STORENAME] & " ' "

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2
I believe it will work if you add these single quotes as shown:

Set rst = CurrentDb.OpenRecordset("SELECT * From tblStores WHERE
tblStores.[STORENAME] = '" & [Forms]![frmStoreForm]![STORENAME] & "'")

Regards,
Mike Parks
Giganews wrote:
I have an Access 97 database were I am opening a recordset in a module
referencing a control on a form. For some reason when the code executes I am
getting an error message stating missing operator and I am not sure why. The
code is as follows:

Public Sub Module1()
Dim rst as recordset

Set rst = CurrentDb.OpenRecordset("SELECT * From tblStores WHERE
tblStores.[STORENAME] = " & [Forms]![frmStoreForm]![STORENAME] & " ")

[STORENAME] is a text field which is why I delimited it with "

Am I missing something?

Any help would be appreciated.

Regards,
Mark

Nov 13 '05 #3
Giganews wrote:
I have an Access 97 database were I am opening a recordset in a module
referencing a control on a form. For some reason when the code executes I am
getting an error message stating missing operator and I am not sure why. The
code is as follows:

Public Sub Module1()
Dim rst as recordset

Set rst = CurrentDb.OpenRecordset("SELECT * From tblStores WHERE
tblStores.[STORENAME] = " & [Forms]![frmStoreForm]![STORENAME] & " ")

[STORENAME] is a text field which is why I delimited it with "

You didn't delimit it properly:

.. . . ORENAME] = """ & [Forms]![frmStoreForm]![STORENAME] &
"""")
--
Marsh
MVP [MS Access]
Nov 13 '05 #4
Thanks for all the help. Problem solved.

Regards,
Mark

"Giganews" <he******@yahoo.com> wrote in message
news:WY********************@comcast.com...
I have an Access 97 database were I am opening a recordset in a module
referencing a control on a form. For some reason when the code executes I
am getting an error message stating missing operator and I am not sure why.
The code is as follows:

Public Sub Module1()
Dim rst as recordset

Set rst = CurrentDb.OpenRecordset("SELECT * From tblStores WHERE
tblStores.[STORENAME] = " & [Forms]![frmStoreForm]![STORENAME] & " ")

[STORENAME] is a text field which is why I delimited it with "

Am I missing something?

Any help would be appreciated.

Regards,
Mark

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

47
by: Andrey Tatarinov | last post by:
Hi. It would be great to be able to reverse usage/definition parts in haskell-way with "where" keyword. Since Python 3 would miss lambda, that would be extremly useful for creating readable...
2
by: Largo SQL Tools | last post by:
Can anyone tell me if it's possible to use a Case statement in a Where clause, and if so, the proper syntax? J.R. Largo SQL Tools The Finest Collection of SQL Tools Available...
2
by: BoB Teijema | last post by:
Hi all, One of our companies is having problems with a query on a linked server. They have two servers, serverA and serverB. On serverA they have set up a linked server to serverB. Query:...
4
by: Tom Walker | last post by:
I cannot get the WHERE statement to work correctly unless I use a literal with the LIKE. I want to use a working storage data name so that I can vary the WHERE statement. Example that works: ...
2
by: kuhni | last post by:
Hi everybody, I have a problem with my SQL-Statement: SELECT * FROM WHERE (((Year > 2003) And (Month <= 6)) Or (Year = 2003)) The WHERE-clause doesn't work properly. As result I receive...
7
by: Britney | last post by:
Original code: this.oleDbSelectCommand1.CommandText = "SELECT TOP 100 user_id, password, nick_name, sex, age, has_picture, city, state, " + "country FROM dbo.users WHERE (has_picture = ?) AND (sex...
7
by: Swinky | last post by:
Mr. Browne's copy code on his web site has saved me. I have been struggling to copy a record with several related sub-form tables. I found code on his web site that copies a sub-form table,...
2
by: Jim.Mueksch | last post by:
I am having a problem with using calculated values in a WHERE clause. My query is below. DB2 gives me this error message: Error: SQL0206N "APPRAISAL_LESS_PRICE" is not valid in the context where...
8
by: chrisdavis | last post by:
I'm trying to filter by query or put those values in a distinct query in a where clause in some sort of list that it goes through but NOT at the same time. Example: ROW1 ROW2 ROW3 ROW4 ,...
6
by: Plissskin | last post by:
I need to create an "ad-hoc" filtering page in a web app we are building. The page would display a number of drop down lists, text boxes, and radio lists and allow the user to select (enter) some...
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...
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...

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.