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 = ))
developingprogrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill RossProgrammerCommented:
Hi,

Of course you can.

Regards,

Bill
0
developingprogrammerAuthor Commented:
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?
0
Bill RossProgrammerCommented:
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
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

Bill RossProgrammerCommented:
BTW -

With DLookup using a parameter as part of the lookup:
SELECT * FROM myTable WHERE ID = DLookup("ID",myLookupTable,"myField='" & [My Parameter] & "'")
0
developingprogrammerAuthor Commented:
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!! = )
0
Bill RossProgrammerCommented:
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
0
Gustav BrockCIOCommented:
No you can't. DLookup will raise an error about your query parameter.

/gustav
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bill RossProgrammerCommented:
Hi,

I just checked and gustav is correct.  You can place the parameters in the DLookup but not the parameter query itself.

Regards,

Bill
0
developingprogrammerAuthor Commented:
great! thanks so much guys! = ))
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.