473,569 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SQL query referencing field values + wildcards

Hello all -

Hopefully there's a quick answer to this one, but I haven't found any
good info in my reference books...

I have a list of customers and a list of prospective customers. All I
care about in these lists are the customer name and zip code. I
basically want to compare my list of prospective customers to the list
of current customers and make sure none of the prospects are doing
business with me already.

The problem is this - the ZIP codes are varied - some are 5 digits,
some are 5+4. I don't want a record to be missed by the query because
of this, so I want to say:

WHERE CurrentCust.Zip LIKE (the value of ProspectiveCust .Zip + %
wildcard)

However, I'm unsure of the syntax there... I've tried

WHERE CurrentCust.Zip LIKE ProspectiveCust & '%' to no avail

I'm using Access 2003.

Can anyone help?

Thanks much,

Jim
Nov 13 '05 #1
1 1623
You could limit the search to the first 5 characters if that would be
acceptable:

WHERE Left(CurrentCus t.Zip,5)=Left(P rospectiveCust, 5)
"James Armstrong" <ar*********@ho tmail.com> wrote in message
news:7c******** *************** ***@posting.goo gle.com...
Hello all -

Hopefully there's a quick answer to this one, but I haven't found any
good info in my reference books...

I have a list of customers and a list of prospective customers. All I
care about in these lists are the customer name and zip code. I
basically want to compare my list of prospective customers to the list
of current customers and make sure none of the prospects are doing
business with me already.

The problem is this - the ZIP codes are varied - some are 5 digits,
some are 5+4. I don't want a record to be missed by the query because
of this, so I want to say:

WHERE CurrentCust.Zip LIKE (the value of ProspectiveCust .Zip + %
wildcard)

However, I'm unsure of the syntax there... I've tried

WHERE CurrentCust.Zip LIKE ProspectiveCust & '%' to no avail

I'm using Access 2003.

Can anyone help?

Thanks much,

Jim

Nov 13 '05 #2

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

Similar topics

3
1943
by: dnl | last post by:
I have a parameter query that I would like to simplify so that I wouldn't need to use wildcards when entering in partial data. The following line is in the criteria field when designing the query: Like Running the query brings up the dialog box to enter the parameter. If the name I am looking for is Smith, I can type "smi*" to do a...
4
1323
by: Scott Cameron | last post by:
Here is what I have. I have a field that lists a product cost and another field that lists how many times that particular product has been purchased (so I would have a record that says I bought 25 of these items at $5.00 each). I need to create either another field or a query that multiplies the two together. I have many such records like...
9
23692
by: Mark | last post by:
I've run a few simple tests looking at how query string encoding/decoding gets handled in asp.net, and it seems like the situation is even messier than it was in asp... Can't say I think much of the "improvements", but maybe someone here can point me in the right direction... First, it looks like asp.net will automatically read and recognize...
3
2254
by: george.lengel | last post by:
Hello experts, I have been struggling for days to solve this problem and every suggestion I find via Google does not work for me. There is probably a solution out there that will do what I want, but I probably have not properly implemented the solutions I find. I am trying to make a page to allow personnel the ability to search our...
2
7848
by: john | last post by:
In a query I have put the following criteria in a field: Now I would like the query to use this user input to search with wildcards. So, if he enters john, in fact the query should search like: *john* Is that possible? Thanks, john
5
2036
by: SeanCly10 | last post by:
Hi all. I don't want to sound like a complete idiot here, but I'm somewhat limited in my coding knowledge, and I need some advice and help. I'm working on a database that will eventually be used to hold patient information for research purposes. What I'm trying to do is create a form-based query system that will be easier (and less...
7
2465
by: servantofone | last post by:
I'm using Access 2003. I'm building a query and wish to display all records with values in a certain field (HIST) made up of all zeros. The field has a range of text values including alpha-numeric characters and may look as follows: "0000000" "10112B1A" "0000" "***111B001" "0000000000" "111000" "0" "00000000000"
2
2107
by: Coll | last post by:
I have a form and a query. I would like to have some control on the form (check box probably), that when selected will limit the criteria for a field in a query. Here are the details.... When the checkbox (or whatever control is appropriate on the form) is checked, the field "employment_category" in my query will have the following criteria...
3
3796
by: Coll | last post by:
I have a form that had been setup with a combo box. You'd select a value from the combo box and a query would open and display matching records. I now need to remove the combo box and set up a text box so the user types in a value and the query opens displaying any records that contain that value in the field. For example, the user enters...
0
7618
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
7678
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
7982
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
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5222
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
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2116
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
1226
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.