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

Displaying Results of a Query on a Form

Status
Not open for further replies.

treadhead

MIS
May 10, 2001
4
US
I am trying to use the results of a query as the value of a field that is displayed on a form. I only get #error when I execute the code. The query works correctly when it's executed by itself, returning a value for PvsD_LName.

The code is :

=DLookUp("PvsD_LName","qryDescName","[CaseNo = ]" & [CaseNumber] & "")

Can anyone look at this and advise what I'm doing wromg or how to fix this.

Thanks in advance for the help.
 
Have you tried

=DLookUp("[PvsD_LName]","qryDescName","[CaseNo] = " & me![CaseNumber])

If Case number is a Number field this should work. I am assuming that casenumber is the name of a form on your field. Kathryn


 
In the case of the form. Where does the Dlookup get the values that query needs in order to return a value? If they are hard coded in the query as parameters that you enter then the form will never know about them and thus the error.

If you have the case number on the form itself try using the forms reference for the case number in your Dlookup statement and see if you get back what you desire.

I hope this helps,

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top