By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,341 Members | 1,619 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,341 IT Pros & Developers. It's quick & easy.

Pass Parameter to Query using Function

P: 2
Hi,

I Have a query that uses a function for setting the Criteria.
When I view the return value of the finction it appears to be exactly what I
want for my criteria. The problem is if I type the criteia directly in the
query all's well however if I set it to the return value of the function I
get no records returned. Here's the function I'm using. Any help is appreciated. Thanks!

Option Explicit
Public Function GetString() As String
Dim strName
strName = "367,1,2"
End Function

I want to use GetString() in a Query(attached to a report) in In Clause in Criteria.
Any help is appreicated. Thanks,
Sep 28 '06 #1
Share this Question
Share on Google+
1 Reply


PEB
Expert 100+
P: 1,418
PEB
Hi my frien,

What you are trying to do, U can do it only in VB when constructing the SQL/ or query!

I follow Your Idea! Congrats!!!

So it's better to create a temporary table in which you stores the values from your list! I see that U don't have pb with VB so maybe U can retrieve your selected items and save them into this temporary table...

The last step for your query is to write in the criteria clause:

IN (SELECT [MYFIELDWITHVALUES] FROM MY-CURRENTTABLE)

:)

Best regards!
Sep 30 '06 #2

Post your reply

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