Dlookup fields

  • Thread starter Thread starter albert
  • Start date Start date
A

albert

Hi there,

I have a form containing "Dlookup" fields, they work fine
but when I try to save, those fields became blank. Anyone
has any idea how to save the contents of the "Dlookup"
fields please? Thanks a lot.
 
Hi Albert

The contents of calculated fields or controls are never saved - they are
just calculated on the fly, as their name suggests.

In a good relational database, it is seldom necessary to save the result of
a calculation. You can achieve the same result as a DLookup much more
efficiently by making a join in a query between the two related tables.

However, if you *really* need to store the contents of a calculated control
(say a textbox with =DLookup...) in a field, you could do it in code in your
form's BeforeUpdate event:
Me.FieldName = Me.DLookupControlName
 
Dear Graham,

Thanks very much for your help, I have now solved my
problem.

Cheers!

-----Original Message-----
Hi Albert

The contents of calculated fields or controls are never saved - they are
just calculated on the fly, as their name suggests.

In a good relational database, it is seldom necessary to save the result of
a calculation. You can achieve the same result as a DLookup much more
efficiently by making a join in a query between the two related tables.

However, if you *really* need to store the contents of a calculated control
(say a textbox with =DLookup...) in a field, you could do it in code in your
form's BeforeUpdate event:
Me.FieldName = Me.DLookupControlName

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

Hi there,

I have a form containing "Dlookup" fields, they work fine
but when I try to save, those fields became blank. Anyone
has any idea how to save the contents of the "Dlookup"
fields please? Thanks a lot.


.
 
Back
Top