A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Querying data from two fields



 
 
Thread Tools Display Modes
  #1  
Old January 29th, 2005, 07:38 AM
Steve Hart via AccessMonster.com
external usenet poster
 
Posts: n/a
Default Querying data from two fields

I have a table that contains the fields Last_Name and Old_Last_Name, among
others. I'm looking to create a query that will return a record if either
of the fields matches a parameter entered by a user.

How can I accomplish this?

TIA,
Steve

--
Message posted via http://www.accessmonster.com
  #2  
Old January 29th, 2005, 01:44 PM
Chris2
external usenet poster
 
Posts: n/a
Default


"Steve Hart via AccessMonster.com" wrote in
message news:4fc2eb3b682341ea80bb46635ded54eb@AccessMonste r.com...
I have a table that contains the fields Last_Name and Old_Last_Name,

among
others. I'm looking to create a query that will return a record if

either
of the fields matches a parameter entered by a user.

How can I accomplish this?

TIA,
Steve


Steve,

It should be something like:

PARAMETERS [Enter Search Parameter] TEXT(255);
SELECT T1.Last_Name
,T1.Old_Last_Name
FROM YourTable as T1
WHERE (T1.Last_Name = [Enter Search Parameter])
OR (T1.Old_Last_Name = [Enter Search Parameter]);


Or, for more flexibility:

PARAMETERS [Enter Search Parameter] TEXT(255);
SELECT T1.Last_Name
,T1.Old_Last_Name
FROM YourTable as T1
WHERE (T1.Last_Name LIKE "*" & [Enter Search Parameter] & "*")
OR (T1.Old_Last_Name LIKE "*" & [Enter Search Parameter] & "*");


(I saved them, so their syntax is ok, but didn't test them.)


Sincerely,

Chris O.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
BUG: Using GROUP BY in query expression on MEMO fields it truncates data in MEMO fields to first 255 characters [SolarAngel] Running & Setting Up Queries 5 December 7th, 2004 06:29 PM
BUG: Using GROUP BY in query expression on MEMO fields it truncates data in MEMO fields to first 255 characters [SolarAngel] Setting Up & Running Reports 5 December 7th, 2004 06:29 PM
How do I get 3 series in sync with the x-axis? zizbird Charts and Charting 10 October 25th, 2004 01:23 PM
Data Source issues. ??data.access.pages Phil Database Design 2 October 11th, 2004 02:42 AM
How to warn users to input data in certain fields Casa General Discussion 1 August 22nd, 2004 09:39 PM


All times are GMT +1. The time now is 02:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.