Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

Query Reference "or"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
meyerryang - 03 Mar 2008 17:11 GMT
I have a query that brings in data based on the Username.  If the record says
"Bob Smith" in the user field then all of Bob Smith's records come up.  I am
limited on my design due to an Oracle backend.  I want to have the Username
say "Bob Smith" or "Bill Jones" and bring up a combined list of either Users
records.  The problem I am having is whenever I update the username on the
form to have more than one user it doesn't recognize the text when it is
linked to the query (ex: "Bob Smith" or "Bill Jones" =forms![My
Form]![Username]).  It works within the query but not when it is linked to
the textbox (Username) that says "Bob Smith" or "Bill Jones".  How else can I
refer to the "or" to get it to recognize that there are two usernames.  

Please do not suggest design restructure, this has an oracle backend and
these tables are not related in anyway.  Thanks in advance.
Roger Carlson - 03 Mar 2008 17:51 GMT
The problem here is what you think is happening is not happening.  You see
"Bob Smith" or "Bill Jones" in the Query builder when you run the query.
But in SQL, it looks like this

[Username] = "Bob Smith" or [Username] = "Bill Jones".

So when you reference a text box with "Bob Smith" or "Bill Jones" in it,
what SQL sees is

[Username] = "Bob Smith or Bill Jones"

and you don't have a user named "Bob Smith or Bill Jones".

What you are going to have to do is parse out your textbox values into two
separate expressions.

On my website (www.rogersaccesslibrary.com), are several small Access
database samples (CreateQueries2-2k.mdb, CreateQueries4-2k.mdb,
CreateQueries5-2k.mdb, CreateQueryFields2k.mdb) which illustrate several
variations on how to do this.

Signature

--Roger Carlson
 MS Access MVP
 Access Database Samples: www.rogersaccesslibrary.com
 Want answers to your Access questions in your Email?
 Free subscription:
 http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L

>I have a query that brings in data based on the Username.  If the record
>says
[quoted text clipped - 14 lines]
> Please do not suggest design restructure, this has an oracle backend and
> these tables are not related in anyway.  Thanks in advance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.