Search Query

kacey8

Registered User.
Local time
Today, 18:43
Joined
Jun 12, 2014
Messages
180
Good Afternoon all,

I have a query which returns the results/fields needed for a search query containing 3 fields

Query name QRY_SearchProp
Fields
- [Address_1]
- [Address_2]
- [Postcode]

Code:
SELECT Table1.ID, Table1.[Address 1], Table1.[Address 2], Table1.Postcode
FROM Table1
WHERE (((Table1.[Address 2]) Like "*" & forms!Search!SrchText & "*" Or ((Table1.postcode) Like "*" & forms!Search!SrchText & "*")));
*Yes I am totally aware calling a table Table1 is bad etiquette, the database is few years old.

So the query works by searching by Address 2 OR the postcode and matches/returns entries which match the text box [SrchText]

Address 1 is the house number, Currently we can't filter by this. so what I am looking to do is:

Address_1 + Address_2 together OR Postcode

However I also need it that if they search by Address_2 (and don't include Address_1 it still returns results.

I hope this makes sense.
 
It's right under your nose--you basically wrote the code you want in your description:

Address1 & Address2

& is the concatenation operator--use that to tie your Address fields together and then apply your criteria to that concatenated string.
 
You beaut, Thanks Plog

A simple & " " & in the middle of the two fields worked flawlessly
 

Users who are viewing this thread

Back
Top Bottom