dvlookup

  • Thread starter Thread starter smason
  • Start date Start date
S

smason

Hello i am trying to show in a form a value from a query using this string in
a form
=DLookUp("[countofJobID]","[qrylivecountCA]","[con] = " &
[Forms]![form1]![consultant3])

how i have done it
countofjobid(the field i want to show)qrylivecountCA(the query) con(the
field for comparison) from the form form1 consultant3(the field to compare
with con)

consultant3 and con show the names of people

but i cannot get the result any ideas
 
hi,
=DLookUp("[countofJobID]","[qrylivecountCA]","[con] = " &
[Forms]![form1]![consultant3])
how i have done it
countofjobid(the field i want to show)qrylivecountCA(the query) con(the
field for comparison) from the form form1 consultant3(the field to compare
with con)
consultant3 and con show the names of people
but i cannot get the result any ideas
Have checked for typos?

Is [con] a string or a number? If it is a string, you need to enclose it
into single quotation marks: ... ,"[con] = '" & [..] & "'")

Does it return any value? Enclose the DLookup with a Nz():

= Nz(DLookup(...), "oops, no value")


mfG
--> stefan <--
 
Hello

The [con] field is a name denoting a consultant working here, basically i
have calculated how many people the [con] has seen (via a qry) and i have
created a form that i want this calculated field to show in! hence the
dlookup! i am using a text field in the form to type in the [con] name and
linking that to the qry! if this makes sence you already have most upmost
admiration
Stefan Hoffmann said:
hi,
=DLookUp("[countofJobID]","[qrylivecountCA]","[con] = " &
[Forms]![form1]![consultant3])
how i have done it
countofjobid(the field i want to show)qrylivecountCA(the query) con(the
field for comparison) from the form form1 consultant3(the field to compare
with con)
consultant3 and con show the names of people
but i cannot get the result any ideas
Have checked for typos?

Is [con] a string or a number? If it is a string, you need to enclose it
into single quotation marks: ... ,"[con] = '" & [..] & "'")

Does it return any value? Enclose the DLookup with a Nz():

= Nz(DLookup(...), "oops, no value")


mfG
--> stefan <--
 
hi,
The [con] field is a name denoting a consultant working here, basically i
have calculated how many people the [con] has seen (via a qry) and i have
created a form that i want this calculated field to show in! hence the
dlookup!
=DLookUp("[countofJobID]","[qrylivecountCA]","[con] = " &
[Forms]![form1]![consultant3])
Change it to (no line breaks and indents of course):

=Nz(DLookUp("[countofJobID]",
"[qrylivecountCA]",
"[con] = '" & Replace([Forms]![form1]![consultant3],
"'",
"''")
& "'"),
"n/a")

The single quotation marks ' are necessary. The Replace() takes care of
single quotation marks in your values. The Nz() handles possible Null
values.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top