Solved Access 2010 query parameters

CosmicJest

New member
Member
VIP
Local time
11:53 AM
Messages
152
Hello,

How do I include a portion of a field in a query parameter?

For example, if one record's data in the field I'm querying is, say, "RPMX-1011" and another record's data is, say, "CO-0852", how do I tell the query I want all records that have "PM" appearing somewhere in the field?
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo ThinkPad E545 / Dell Optiplex 980
OS
Windows 7 Pro 64-bit
CPU
AMD 2.9GHz / Intel 3.2GHz
Memory
8GB / 4GB
Antivirus
AVG / Norton 360
Browser
Firefox & Chrome
select * from tablename where fieldname like "*PM*"
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0

My Computer

Computer Manufacturer/Model Number
Custom Box
OS
Windows 7 Professional x64
CPU
AMD Phenom II X4 980 Black Edition @ 4.1Ghz
Motherboard
ECS Elite Group IC780M-A V2.0
Memory
8GB Crucial DDR2 PC5300
Graphics Card(s)
Asus Radeon HD 5450
Sound Card
On Board
Monitor(s) Displays
Dual Monitor Setup
Hard Drives
60GB OCZ Vertex 3 SSD,
320GB, 250GB, & Dual 160GB HDD's
PSU
Cooler Master eXtreme Power Plus 500w
Case
Cooler Master Elite 310
Cooling
Dual 120mm Cooler Master Case Fans
Keyboard
Logitech...
Mouse
Microsoft Mouse 4000
Internet Speed
Super Fast
I'm sorry - it's clear to you two, but not to me. When you say "select * from tablename", does that mean I drag the * into my query? And what does "where fieldname like "*PM*" mean? Do I type "like "*PM*"" somewhere? I'm not getting the results I need.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo ThinkPad E545 / Dell Optiplex 980
OS
Windows 7 Pro 64-bit
CPU
AMD 2.9GHz / Intel 3.2GHz
Memory
8GB / 4GB
Antivirus
AVG / Norton 360
Browser
Firefox & Chrome
You're making a query using fields drag and drop? Then make the query as complete as you can. Can you make a parameter query? for example can you make a query that displays the birthday and name but only of the persons with name "Johnson"? I don't know your skills so don't know who to explain
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
Well, the query already exists (I've been using it for some time even tho it doesn't give me fully accurate results), so I opened it and changed to Design view so I can edit it. From there, I dragged the * from the available fields in the table I'm using into the query. Yes, I believe I could do a query for all people named Johnson with a certain birthdate.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo ThinkPad E545 / Dell Optiplex 980
OS
Windows 7 Pro 64-bit
CPU
AMD 2.9GHz / Intel 3.2GHz
Memory
8GB / 4GB
Antivirus
AVG / Norton 360
Browser
Firefox & Chrome
Make the query as good as possible. After that change to sql view. Post sql statement here please.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
SELECT [Business Licenses].[Lic#], [Business Licenses].BusinessName, [Business Licenses].FName, [Business Licenses].LName, [Business Licenses].MailAddr, [Business Licenses].City, [Business Licenses].State, [Business Licenses].Zip, [Business Licenses].BsPh
FROM [Business Licenses]
WHERE ((([Business Licenses].[Lic#]) Like "*PM*") AND (([Business Licenses].TypeOfBs)="property management"));
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo ThinkPad E545 / Dell Optiplex 980
OS
Windows 7 Pro 64-bit
CPU
AMD 2.9GHz / Intel 3.2GHz
Memory
8GB / 4GB
Antivirus
AVG / Norton 360
Browser
Firefox & Chrome
your query is right!
It displays all fields listed after select. But only for those records where TypeOfBs="property management" and Lic# like "*PM*"

what's the problem????
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
The problem is there are some licenses that have "PM" as part of their license number that are not being included in the query results. Perhaps it's because there is also other text in the "property management" field?
 
Last edited:

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo ThinkPad E545 / Dell Optiplex 980
OS
Windows 7 Pro 64-bit
CPU
AMD 2.9GHz / Intel 3.2GHz
Memory
8GB / 4GB
Antivirus
AVG / Norton 360
Browser
Firefox & Chrome
TypeOfBs="property management" is also part of the criteria
so "property management" isn't included. Nor is "property management 123"

Logic isn't it?
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
ACER ASPIRE 5742G
OS
Microsoft Windows 7 Home Premium 64-bits 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i3 CPU M 370 @ 2.40GHz
Motherboard
Acer Aspire 5742G
Memory
4,00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5400 Series
Sound Card
(1) AMD High Definition Audio Device (2) Realtek High Defi
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-22ZAT0
OK - I got it! I changed TypeOfBs to: like *property management* and the missing records came up! Thanks Kaktussoft!
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo ThinkPad E545 / Dell Optiplex 980
OS
Windows 7 Pro 64-bit
CPU
AMD 2.9GHz / Intel 3.2GHz
Memory
8GB / 4GB
Antivirus
AVG / Norton 360
Browser
Firefox & Chrome
Back
Top