Parameter issue

  • Thread starter instereo911 via AccessMonster.com
  • Start date
I

instereo911 via AccessMonster.com

Hi everyone,

I have a problem with a parameter (well not a problem but i wanted to see if
it is possible)

one of my columns called OPERID on a table called Table.
The OPERID field is 4 bytes. Some examples of the OPERID are:

47AD
4768
8831
3C4D
etc

I want to set a parameter in a query to pull the following:

[Enter Unit Number] which the input would be the first two digits: Example:
User enters [47] and it will pull all of 47 on first two digits of OPERID. So
output would be 47AD and 4768

I hope that make sense, but I don't know what to do.

Thanks everyone
 
D

Dorian

use:
WHERE LEFT(OPERID,2) = [First2DigitsParameter]
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
I

instereo911 via AccessMonster.com

Hey Dorian,

Thanks for responding so quickly - but it still didn't work. I think the
reason could be that it is that parameter that you listed below only is
showing what would be considered 47 and that is it.. but i really want 47**
(that probably doesn't make sense)


Here is my code (note operator id is really OPERID)

SELECT Westhostinq.CCN, Westhostinq.Name, Westhostinq.CustID, Westhostinq.
RecDate, Westhostinq.MethInd, Westhostinq.RouteTo, Westhostinq.PendInq,
Westhostinq.[Operator ID]
FROM Westhostinq
WHERE (((Westhostinq.MethInd)="i" Or (Westhostinq.MethInd)="j") AND (Left
("Operator ID",2)=[First2DigitsParameter]))
ORDER BY Westhostinq.RecDate;

use:
WHERE LEFT(OPERID,2) = [First2DigitsParameter]
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
Hi everyone,
[quoted text clipped - 19 lines]
Thanks everyone
 
J

John Spencer MVP

Or use the like operator which should be faster if there is an index on the field

WHERE OperID Like [Enter two characters] & "*"

In query design view
Field: OperID
Criteria: Like [Enter two characters] & "*"


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
use:
WHERE LEFT(OPERID,2) = [First2DigitsParameter]
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


instereo911 via AccessMonster.com said:
Hi everyone,

I have a problem with a parameter (well not a problem but i wanted to see if
it is possible)

one of my columns called OPERID on a table called Table.
The OPERID field is 4 bytes. Some examples of the OPERID are:

47AD
4768
8831
3C4D
etc

I want to set a parameter in a query to pull the following:

[Enter Unit Number] which the input would be the first two digits: Example:
User enters [47] and it will pull all of 47 on first two digits of OPERID. So
output would be 47AD and 4768

I hope that make sense, but I don't know what to do.

Thanks everyone
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top