Using DLookUp in continuous form (multiple records)

  • Thread starter Krzysztof Bartosiewicz
  • Start date
K

Krzysztof Bartosiewicz

Hi!
I have a subform of a form which view is continuous - it shows many records
at once. I tried to use an editbox which should be somehow filled with a
text from a query. I created a query

SELECT [Medicines].[ID_MEDICINE], [Medicines].[MedicineName],
[MedicineGroups].[MedicineGroupName]
FROM Medicines, MedicineGroups
WHERE Medicines.ID_MEDICINEGROUP = MedicineGroups.ID_MEDICINEGROUP;

and I tried something like

=DLookUp("MedicineGroupName";"[Query_Medicines]";"Medicines.ID_MEDICINE=" &
[ID_MEDICINE])

The problem is that the value of the field is calculated calculated once and
all records have the same value in the edit box no matter what ID.MEDICINE
is (all fields have the value connected with the ID.MEDICINE of the 1st
record)

Is there any way to fix this problem? Maybe I should use some VBA code to
force MS Access to calculate the value in EACH record separately basing on
the value of ID_MEDICINE field in that record..
But which event should I use and what code should be placed there? Maybe
some refreshing or somthing?

Thanks in advance for help
Chris Bartosiewicz
 
K

Krzysztof Bartosiewicz

Hmm.. It's not a problem any more :)

I struggled with that problem for a while and after I send the mail to the
newsgroup I realised how simple it was..

The entry:
=DLookUp("MedicineGroupName";"[Query_Medicines]";"Medicines.ID_MEDICINE="
&[ID_MEDICINE])
was cerrect but I used it in default value instead of the source...

Sorry for bothering you..
Chris
 

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

Top