Is there anyway to make an access query look at a Modules for the parameter that you want to pass to it.
If so how do you have to set the query up.
Printable View
Is there anyway to make an access query look at a Modules for the parameter that you want to pass to it.
If so how do you have to set the query up.
if I remeber correctly ... you have to use functions declared as PUBLIC only... it's possible also that the returned value has to be variant (not sure about that last one thought)
hope it helps
and i write the functions in the module, but how does the query know to get them
Create the query from a VB function, using SQL, then shove it into the query and execute.
Are you doing this in MS-ACCESS or are you accessing an ACCESS database via vb??
IN MS-ACCESS:
If you use the design view to create your queries then you just have to name the function in the criteria section under the right column.
If you are not sure, try using the expression buider. in the criteria section, right click and select "BUILD..." and then go to FUNCTIONS. There you have 2 choices: BUILT-IN and the other one has the name of your database. choose that last one and you should see your function in the list on the right.
VIA VB:
Just concatenate (hope I speled it right, I speak french:)) your function in your query defenition.
Example
SomeRecordSet = Database.OpenRecordset ("SELECT * FROM UserTable WHERE User_Name = '" & GetUserName & "'")