Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for an Expression for a Query 1

Status
Not open for further replies.

achiola

MIS
Apr 26, 2001
44
US
I am looking for an expression in a Query that will look at a particular field, analyze the data and return a particular statement. For example:


Field 1

GLP002
GRS003
GLP004
TRE445

I want an expression that will look at this feild for the data types beginning with "GLP..."and return the word "hardcoded" in the field adjacent to it when it finds it.

Field 1 Field 2

GLP002 hardcoded
GRS003
GLP004 hardcoded
TRE445

Can anyone help?

Nino
 
function:
function xxxx(x as string) as string
if x like "GLP*" then
xxxx = "hardcoded"
else xxxx = ""
end if
end function
query:
select Field1, xxxx(field1) as field2 from YourTable
John Fill
1c.bmp


ivfmd@mail.md
 
I'm not so familiar with VB and do not know what is IIF for. My current programming environments are C++ and SQLServer. John Fill
1c.bmp


ivfmd@mail.md
 
By the way, have you forgotten so fast about 'in(...)'? :) John Fill
1c.bmp


ivfmd@mail.md
 
Terry,

I do apologize, but I thought your if statement would work but for some reason it is not. I can't figure out why?

Nino
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top