Link to home
Start Free TrialLog in
Avatar of developingprogrammer
developingprogrammer

asked on

dlookup parameter queries

guys!! super silly question but thought i'd just ask it anyway haha = )

is it technically possible to dlookup a parameter query?

i think it's not possible cause we're passing a string into the dlookup function for the domain.

also, having the parameter in the query is already a dlookup. just that of course we're returning a recordset instead of a single value.

let me know how silly you think this question is!! thanks!! haha = ))
Avatar of Bill Ross
Bill Ross
Flag of United States of America image

Hi,

Of course you can.

Regards,

Bill
Avatar of developingprogrammer
developingprogrammer

ASKER

thanks Bill! how would you do it? how would you input the parameters? in a querydef object? if so then how do you look up that unsaved querydef object?
Hi,

Put the dlookup statement where the parameter is:

With parameter:
SELECT * FROM myTable WHERE ID = [My Parameter]

With DLookup (assuming myField is a text field:
SELECT * FROM myTable WHERE ID = DLookup("ID",myLookupTable,"myField='myValue'")

Regards,

Bill
BTW -

With DLookup using a parameter as part of the lookup:
SELECT * FROM myTable WHERE ID = DLookup("ID",myLookupTable,"myField='" & [My Parameter] & "'")
thanks Bill!

what i meant was can i do something like this

DLookup("RowID","qryMyParameterQuery")

where qryMyParameterQuery takes say 2 parameters?
i don't think that is possible but i would love to be corrected! thanks!! = )
Hi,

Sure you can.  Just join the query correctly and the dlookup will work fine.

FYI - I would use a form to hold the parameter variables so you don't have to retype them and the values may be looked up insted.

Regards,

Bill
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
great! thanks so much guys! = ))