Dlookup fields

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.
 
G

Graham Mandeno

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
 
A

Albert

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.


.
 

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