473,614 Members | 2,351 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using LIKE in a Parameter Query - Access 2000

1 New Member
I am not a real well versed query writer and therefore am having some problems figuring out how to write a parameter query where I want to input a partial name. I have tried a few different things, but either get no results or all of the records in BANKS are returned.

I am using Access 2000 on XP. I am using three tables for this query:
Expand|Select|Wrap|Line Numbers
  1. BANKS
  2.   BankID (pk)
  3.   BankName
  4.   Other fields that are not pertinent to this query
Expand|Select|Wrap|Line Numbers
  1. VENDORS
  2.   VendorID (pk)
  3.   VendorName
  4.   Other fields that are not pertinent to this query
Expand|Select|Wrap|Line Numbers
  1. BANKVENDORS
  2.   BankID
  3.   VendorID (both fields combined make up the pk)
I want to list the BankName and VendorName based on VendorName. I am using BANKVENDORS to link the two tables. Since the VendorName is generally long (i.e. Federal Reserve Bank of Atlanta), I want the user to be able to enter only a portion of the VendorName (i.e. Atlanta) and have the query return all Banks and Vendors where the VendorName contains the word Atlanta.

Here is what I have so far in the query (I used the Wizard to create it):
Expand|Select|Wrap|Line Numbers
  1. SELECT Banks.BankName, Vendors.VendorName
  2. FROM Vendors INNER JOIN (Banks INNER JOIN BankVendors ON Banks.BankID = BankVendors.BankID) ON Vendors.VendorID = BankVendors.VendorID
  3. WHERE (((Vendors.VendorName)=[Enter Vendor Name]));
Thanks for any help you can provide.

-Carolyn
Feb 2 '08 #1
4 2908
FishVal
2,653 Recognized Expert Specialist
Hi, Carolyn.

Try
Expand|Select|Wrap|Line Numbers
  1. SELECT Banks.BankName, Vendors.VendorName
  2. FROM Vendors INNER JOIN (Banks INNER JOIN BankVendors ON Banks.BankID = BankVendors.BankID) ON Vendors.VendorID = BankVendors.VendorID
  3. WHERE (((Vendors.VendorName) ='*' & [Enter Vendor Name] & '*'));
  4.  
or, if SQL syntax option in your db is set to ANSI92, then

Expand|Select|Wrap|Line Numbers
  1. SELECT Banks.BankName, Vendors.VendorName
  2. FROM Vendors INNER JOIN (Banks INNER JOIN BankVendors ON Banks.BankID = BankVendors.BankID) ON Vendors.VendorID = BankVendors.VendorID
  3. WHERE (((Vendors.VendorName) ='%' & [Enter Vendor Name] & '%'));
  4.  
Regards,
Fish
Feb 2 '08 #2
NeoPa
32,566 Recognized Expert Moderator MVP
I think you need to replace the "=" with "LIKE" in Fish's examples.
Expand|Select|Wrap|Line Numbers
  1. SELECT Banks.BankName,
  2.        Vendors.VendorName
  3. FROM Vendors INNER JOIN (Banks INNER JOIN BankVendors
  4.   ON Banks.BankID = BankVendors.BankID)
  5.   ON Vendors.VendorID = BankVendors.VendorID
  6. WHERE (Vendors.VendorName LIKE '*' & [Enter Vendor Name] & '*')
If you're using Access 2000, it will only support ANSI89 I think.
Feb 5 '08 #3
FishVal
2,653 Recognized Expert Specialist
Ooops.
Certainly "=" is a typo. It should be "LIKE".
Thanks NeoPa.
Feb 6 '08 #4
NeoPa
32,566 Recognized Expert Moderator MVP
No worries my friend. We're all part of a good team :)
Feb 6 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3907
by: Richard Muller | last post by:
Hi All, I've got the ASP script shown below that complains as follows: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) Data source name not found and no default driver specified /ShowEvents.asp, line 24 Line 24 of the script is the line:
3
16938
by: WGW | last post by:
Though I am a novice to MS SQL server (2000 I believe), I can do almost! everything I need. Maybe not efficiently, but usefully. However, I have a problem -- a complex query problem... I can create a parameter query in a stored procedure, but how do I use the result set of a parameter query in a select query (in the same or another sp)? In short, if a select query contains a result table that is generated as a parameter query, how do I...
4
3518
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The objective in utilizing this new deployment method is to reduce the maintenance overhead as well as making it easier for my users to setup and run the application initially. I have VS 2002, Windows XP, Access XP(2000 format). He is my problem....
2
4426
by: ILCSP | last post by:
Hello, I'm in the process of changing our 'normal' Access 2000 update queries to Update Pass Through Queries. We have a SQL server 2000 database and we're using an Access 2000 database as our front end. In the criteria of one of our update query fields, we use both the isnull(field1) and Not IsNull(field2) then Field3, otherwise, set the updated field as null. Here's my converted Pass Through Query : UPDATE Vsel SET VSel.Cert1 =...
10
6716
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that contains only tables. I have linked the tables for the front end to the back end database. I am trying to set the recordsource of a form to a query established by the user to narrow the scope but I don't want to display the form if there are no...
8
2796
by: rbg | last post by:
I did use query plans to find out more. ( Please see the thread BELOW) I have a question on this, if someone can help me with that it will be great. In my SQL query that selects data from table, I have a where clause which states : where PermitID like @WorkType order by WorkStart DESC
3
4203
by: Clearview | last post by:
This is my first post to the forum and hoping I can get help as I have spent a way too much time on this problem, and thinking it is probably something really simple to resolve. I am using Access 2000 and trying to create a Query which draws its parameters from a Report Criteria Selection Form, which will define the data source for a report. On a Report Selection Form if user enters a part# containing "PP" then criteria will be for the...
2
10105
by: deanoooo812 | last post by:
I have an Access query (written in MS Access 2000 - thats all we've got - don't get me started on that topic...) for making pharmacy dispensing labels based on an extract from an automated dispensing machine extract. In this query, I use an expression to calculate the total tablet requirement from a combination of the table value of Sum of DailyQty * DaysSupply. DaysSupply is a parameter that is entered by the user when running the query....
2
4077
by: acw | last post by:
On a SQL Server 2000 db I would like to setup a stored procedure that accesses couple tables and runs the extended stored procedure xp..cmdshell. The goal is to grant users with limited privileges the right to run the stored procedure but not the rights to directly access either the referenced tables or the extended stored procedure. TIA!
0
8142
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8589
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6093
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2573
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
1757
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.