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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Query criteria via a function

Status
Not open for further replies.

CDSIEGroup

Technical User
Sep 26, 2000
8
US
I have a query that needs to be exported and I want to pass it criteria via a function. One of the fields is Employee and it contains Exempt or NonExempt. I want to use 1 query to export the data for Exempt, NonExempt and all employees. I can get it to work for just Exempt or just NonExempt but not both with the following function:

Public Function EmpType() As String
EmpType = "Exempt"
'Call Export Data Function
EmpType = "NonExempt"
'Call Export Data Function
End Function

I need to pass the query something that it sees as "Exempt" Or "NonExempt" but nothing seems to work. Any Ideas?

Thanks for the help,
Josh
 
Try this:

Code:
Public Function EmpType() As String
EmpType = "='Exempt'"
'Call Export Data Function
EmpType = "'NonExempt'"
'Call Export Data Function
Emptype = "Like(*Exempt)"
End Function

If your query is set up with a Where clause like "..where Emptype = " and your Function parameter, you'll need to change it to just plain old "...where EMPTYPE ", and pass the " ='Exempt'" or " ='NonExempt'" and "Like(*Exempt)"

In other words, pass the OPERATOR and the VALUE , not just the value...

Make sense?







--------------------------------------
"For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled." - Richard P. Feynman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top