Yes, DLookup() works somewhat like a query, but it only returns the first
result it finds, not all the matching records as a query does. It is usually
used with a unique value for the criteria so that there is only one value to
be found. To use it, it is probably easiest to make a "calculated control".
To do that, you place an equation in the control's Control Source instead of
a field.
Example:
=DLookup("CondID", "tblProduct_Sales", "CondID = 1")
Usually, you don't use the same field in the condition and the return field,
you know the value of this field already, you don't need to look it up. You
would return another field from the record that matches the condition.
If you are wanting to return multiple fields from the record, it may be
better to use a listbox with multiple columns. You could place a query in
the Row Source of the listbox. The query's criteria would limit the record
returned, but you could display all of the fields from the record.
What you described in your first message as wanting to do IS what a subform
does. The scenario you gave in your second message is slightly different
from this one. I don't fully follow what you're trying to do.
--
Wayne Morgan
MS Access MVP
"Beacher" <be*****@gmail.com> wrote in message
news:11********************@g44g2000cwa.googlegrou ps.com...
Thank you very much :)
I never have used DLookup() before...infact I haven't done much in
vba.. but I looked up the use for it.. does it somewhat act like a
query? Would I use the parent table and use the primary key field to
look up the specific number I need? and if so, how would I put the
results of the DLoopup() into a subform/Datasheet
DLookup("FieldName" , "TableName" , "Criteria = n")
Dloopup("CondID","tblProduct_Sales","CondID = 1") Would show me all
results where the CondID field = 1 correct? if so, I need to display
the whole row not just the one field